Renderer From JSON
Hi all !
I am trying to create a personalized Rendere via ESRI.ArcGIS.Client.Renderer.FromJson("").
However I do not know what to put in argument. Have someone an example for a point or a line?
Secondary question: is it possible to pass a svg into this JSON?
Thanks
Hadrien
0
-
Here is an example for a point:
ESRI.ArcGIS.Client.Renderer.FromJson("{'type':'simple','symbol':{'type': 'esriSMS', 'style': 'esriSMSSquare', 'color': [76,115,0,255], 'size': 8, 'angle': 0, 'xoffset': 0, 'yoffset': 0, 'outline':{'color': [152,230,0,255],'width': 1 }}}")
I also succeed with a svg (work also with a png):
ESRI.ArcGIS.Client.Renderer.FromJson("{'type':'simple','symbol':{'type': 'esriPMS','url' : 'http://localhost/mypath/mypicture.svg', 'imageData': ‘YourBase64encodedImageData', 'contentType' : 'image/svg+xml','color' : [204,204,255,255],'width' : 19.5,'height' : 19.5, 'angle' : 0, 'xoffset' : 0, 'yoffset': 0}}")
However:
- the color attribute do not seem to affect my svg
- the html code I retrieve from this json string is encoded as an image. A vector line for example is encoded as a path. Inside of the svg, it is encoded as a path (see below). So i supposed it should be possible to overstep the image encoding and keep only the code inside the svg. In this way, the svg should be affected by the choosen scale, such as a vector.MyLine in the viewer HTML <path fill="none" fill-opacity="0" stroke="rgb(255, 0, 0)" stroke-opacity="1" stroke-width="8" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4" path="M 593,77 598,85 … 749,322" d="M 593 77 598 85 … 749 322" stroke-dasharray="none" dojoGfxStrokeStyle="solid"></path> My SVG in the viewer HTML <image fill-opacity="0" stroke="none" stroke-opacity="0" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4" x="555.3333333333334" y="135" width="13.333333333333332" height="68" preserveAspectRatio="none" xlink:href="data:image/svg+xml;base64,YourImageEncoded64" opacity="1" transform="matrix(0.61566148,0.78801075,-0.78801075,0.61566148,349.17206823,-377.90883286)"></image>
If someone have an idea to transform the svg into a readable vector, it would be kind!
Regards
Hadrien0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar