[mapguide-users] Adding marker on the fly with tooltip
Kencana
bluesky_dyx at hotmail.com
Mon Nov 12 04:38:28 EST 2007
Hi Jackie,
I have one doubt. I was wondering, why i can't put special character in the
tool tip e.g. !@#$ and the white space as well. any idea on how to solve
this?
Thank you
Regards,
Kencana Kesuma
Jackie Ng wrote:
>
> What I mean is that the xml fragment you specified does not constitute a
> layer definition document.
>
> Therefore there must be some kind of "outer" xml document that that
> fragment would have be merged with to form a valid layer definition
> document.
>
> Looking at the php code (and I'm just grabbing thin air here). I'm
> guessing $factory->CreateLayerDefinition() is where the outer xml document
> comes from. So take a look at that function, as that is probably where you
> insert your tooltip tag.
>
> - Jackie
>
>
> Kencana wrote:
>>
>> Hi Jacky,
>>
>> Thanks for the reply.
>>
>> I don't quite understand what you mean by outer xml. anyway, this is what
>> i did for drawing the marker. also I have attached 1 layer definition
>> file, templ file, and also the layerdefinition.php file (the file
>> consists the function in drawing the marker based on the xml file). I
>> hope you can help me out. And I am really appreciate that.
>>
>> Thank you
>>
>> Regards,
>> Kencana Kesuma
>>
>> $factory = new LayerDefinitionFactory();
>>
>> // Create a mark symbol
>>
>> $resourceId = 'Library://Migrated Files/Stars.SymbolLibrary';
>> $symbolName = 'Red';
>> $testing = 'Test 123';
>> $width = '25'; // points
>> $height = '25'; // points
>> $color = 'FFFF0000';
>> $markSymbol = $factory->CreateMarkSymbol($resourceId, $symbolName,
>> $width, $height, $color);
>>
>> // Create a text symbol
>>
>> $text = "ID";
>> $fontHeight="12";
>> $foregroundColor = 'FF000000';
>> $textSymbol = $factory->CreateTextSymbol($text,
>> $fontHeight, $foregroundColor);
>>
>> // Create a point rule.
>>
>> $legendLabel = 'trees';
>> $filter = '';
>> $pointRule = $factory->CreatePointRule($legendLabel,
>> $filter, $textSymbol, $markSymbol);
>>
>> // Create a point type style.
>>
>> $pointTypeStyle = $factory->
>> CreatepointTypeStyle($pointRule);
>>
>> // Create a scale range.
>>
>> $minScale = '0';
>> $maxScale = '1000000000000';
>> $pointScaleRange = $factory->CreateScaleRange($minScale,
>> $maxScale, $pointTypeStyle);
>>
>> $featureName = 'PointSchema:Points';
>> $geometry = 'GEOM';
>> $layerDefinition = $factory->
>> CreateLayerDefinition($featureSourceName, $featureName,
>> $geometry, $pointScaleRange);
>>
>> // Add the layer to the map
>> $newLayer = add_layer_definition_to_map($layerDefinition, "Points",
>> "Points of Interest", $sessionId, $resourceService, $map);
>> add_layer_to_group($newLayer, "Analysis", "Analysis", $map);
>>
>>
>>
>>
>>
>>
>>
>> Jackie Ng wrote:
>>>
>>> Do you have an "outer" xml template that you are merging this with? If
>>> so, that's the one where you'll have to place the <ToolTip> tag under.
>>>
>>> - Jackie
>>>
>>>
>>> Kencana wrote:
>>>>
>>>> Hi Jacky,
>>>>
>>>> Thank you for the reply.
>>>> Anyway I can't find the geometry tag under the marksymbol.templ.
>>>> this is what i have in markersymbol.templ
>>>>
>>>> <W2D>
>>>> <Unit>Points</Unit>
>>>> <SizeContext>DeviceUnits</SizeContext>
>>>> <SizeX>%s</SizeX>
>>>> <SizeY>%s</SizeY>
>>>> <Rotation>0</Rotation>
>>>> <MaintainAspect>true</MaintainAspect>
>>>> <W2DSymbol>
>>>> <ResourceId>%s</ResourceId>
>>>> <LibraryItemName>%s</LibraryItemName>
>>>> </W2DSymbol>
>>>> <FillColor>%s</FillColor>
>>>> <LineColor>FF000000</LineColor>
>>>> <TextColor>FF000000</TextColor>
>>>> <ToolTip>test 123</ToolTip>
>>>> </W2D>
>>>>
>>>>
>>>> I did make some changes to the LayerDefinition-1.0.0.xsd and the error
>>>> message has gone. however,
>>>> i can't see the tool tip when i mouse over the marker.
>>>>
>>>> any idea of this?
>>>> anyway i am still using mapguide opensource 1.1.0.
>>>> because the new version (1.2) the marker is not shown on the map.Have
>>>> mentioned about this issue in this forum, but so far I havent see any
>>>> solution for it yet.
>>>>
>>>> Thank you
>>>>
>>>> Regards,
>>>> Kencana
>>>>
>>>>
>>>> Jackie Ng wrote:
>>>>>
>>>>> Did you put the tooltip tag in the right location? The <ToolTip> tag
>>>>> usually follows the <Geometry> tag in a layer definition document.
>>>>>
>>>>> - Jackie
>>>>>
>>>>>
>>>>> Kencana wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can we modify the markersymbol.templ file to add <ToolTip></ToolTip>
>>>>>> tag into it?
>>>>>> I have try to add it but it returns me such error message.
>>>>>> ERROR: The new XML document is invalid.
>>>>>> .PHP Warning: Element W2D content check failure in C:\Program
>>>>>> Files\MapGuideOpenSource\WebServerExtensions\www\CAN MAP
>>>>>> Files\layer_functions.php on line 27 PHP Fatal error: Call to a
>>>>>> member function SetGroup() on a non-object in C:\Program
>>>>>> Files\MapGuideOpenSource\WebServerExtensions\www\CAN MAP
>>>>>> Files\layer_functions.php on line 66
>>>>>>
>>>>>> any idea on how i can make it work?
>>>>>>
>>>>>> Thank you
>>>>>>
>>>>>> Regards,
>>>>>> Kencana Kesuma
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>> http://www.nabble.com/file/p13699701/LayerDefinition-1.0.0.xsd
>> LayerDefinition-1.0.0.xsd
>> http://www.nabble.com/file/p13699701/layerdefinitionfactory1.php
>> layerdefinitionfactory1.php
>> http://www.nabble.com/file/p13699701/marksymbol.templ marksymbol.templ
>>
>
>
--
View this message in context: http://www.nabble.com/Adding-marker-on-the-fly-with-tooltip-tf4788633s16610.html#a13702462
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list