[Pharo-dev] SVG described countries in Roassal

Stéphane Ducasse stephane.ducasse at inria.fr
Sun Nov 17 11:53:35 EST 2013


> Within Roassal I need to have a svg shape that knows about a path.
> Currently I do not make use of Athens to draw the SVG, I simply use Athens to draw lines. 

But in roassal you do not have the concept of a polylines? 
Ok I saw that SVGPath are not polyline as I originally thought. NOw

I do not get why you want to pollute Roassal with SVG names.
If you introduce the notion of Path why don;t you do it independent of SVG
because SVG is one way to represent path. 


> Within Roassal I can define any SVG path as a shape. For example: 
> 	view add: (ROSVGPath path: 'M10,10 L30,30') element
> 
> Why this should not be at the level of Roassal? If I want to define a box, I would simply do
> 	view add: (ROBox new extent: 30 @ 20) element

Because I think that as a user I do not want to if my code works on svg or another external format.

> It follows the same pattern no?

Yes but this is different because ROBox is a roassal box not an svg or another format.
If tomorrow you get a pdf reader and access a library of pdf library. Do you want your reader to 
have ROPDFBox? 

in SVG you also have  

Rectangle <rect>
Circle <circle>
Ellipse <ellipse>
Line <line>
Polyline <polyline>
Polygon <polygon>
Path <path>
So I imagine (and hope) that you will not introduce ROSVGRectangle ROSVGLine
ROSVGCircle?

So why introducing ROSVGPath


Stef
> 
> Alexandre
> 
> 
> On Nov 17, 2013, at 8:45 AM, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> 
>> I see that you have a loooot of fun.
>> Now I have the impression that in the future version you should not expose ROSVGPath and others 
>> because there are at the importer level not Roassal. So why do you need to wrap them.
>> If there is something missing in SVGPath what is it?
>> 
>> Stef
>> 
>>> Hi!
>>> 
>>> I had fun understanding how countries may be described using SVG.
>>> Here is a first shoot:
>>> 
>>> <Screen Shot 2013-11-16 at 5.36.21 PM.png>
>>> 
>>> Moving the mouse above a country name highlight the country. You can now rehearse your geography.
>>> 
>>> The complete source code of this example is:
>>> 
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>> | view element nameComponent label |
>>> view := ROView new.
>>> 
>>> ROSVGPath countries do: [ :k |
>>> 	element := (ROSVGPath path: (ROSVGPath perform: k)) elementOn: k.
>>> 	view add: element.
>>> ]. 
>>> 
>>> nameComponent := ROElement new.
>>> ROSVGPath countries do: [ :k |
>>> 	label := ROLabel elementOn: k asString.
>>> 	label @ ROLightlyHighlightable.
>>> 	label on: ROMouseEnter do: [ :event | ROBlink highlight: (view elementFromModel: event model asSymbol) ].
>>> 	label on: ROMouseLeave do: [ :event | ROBlink unhighlight: (view elementFromModel: event model asSymbol) ].
>>> 	nameComponent add: label.
>>> ].
>>> ROGridLayout new
>>> 	gapSize: -3;
>>> 	lineItemsCount: 15;
>>> 	on: nameComponent elements.
>>> 	
>>> view add: nameComponent.
>>> nameComponent translateTo: 0 @ 400.
>>> 
>>> view openInWindowSized: 1000 @ 700
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>> 
>>> Cheers,
>>> Alexandre
>>> -- 
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>> 
>>> 
>>> 
>> 
> 
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131117/53aa166e/attachment-0002.html>


More information about the Pharo-dev mailing list