NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Maswood,
If I would like to change the symbol of circled dot to ellipses or any other new defined symbol , How should I do that ? >From the layout model editor ( http://www.unidata.ucar.edu/software/IDV/docs/userguide/tools/StationModelEditor.html) I can chose different symbol like triangle or diamond. but no option to add new symbol . for that what should I do ? Which package or java file is associated with this adding or changing new symbol ?
You can define new symbol types through an xml format. These will show up as a new shape in the layout model editor palette.
Attached is an example file that defines 2 new kinds of symbols. If you put this file in your local .metapps directory or in a plugin
they will show up in the palette.We can also add some new pre-defined shapes that will show up in the list of shapes. e.g., we could add an ellipsis. You could figure out the coordinates of the shape using the xml and then send it to us and we can roll it into the code.
If you want to look at the code that defines the shapes look in the source: ucar/visad/ShapeUtility In there we have code that looks like: } else if (s.equals(AIRPLANE)) { scale = 1.2f; shape = new VisADTriangleArray(); shape.coordinates = new float[] {0.0f, -1.0f, 0.0f, 0.1f, 0.8f, 0.0f, -0.1f, 0.8f, 0.0f, 0.0f,
-0.9f, 0.0f, 0.1f, 0.8f, 0.0f, -0.1f, 0.8f, 0.0f, -0.025f, -0.9f, 0.0f, 0.025f, -0.9f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,0.35f, 0.0f, 0.0f, 0.05f, 0.0f, 0.8f, 0.0f, 0.0f, 0.0f, 0.35f, 0.0f, 0.0f, .05f, 0.0f, -0.8f, 0.0f, 0.0f, 0.0f, -0.75f, 0.0f,
0.0f, -0.85f, 0.0f, .25f, -0.85f, 0.0f, 0.0f, -0.75f, 0.0f, 0.0f, -0.85f, 0.0f, -0.25f, -0.85f, 0.0f }; ...
-Jeff
<?xml version="1.0" encoding="ISO-8859-1"?> <symbols> <!-- This xml allows you to specify new kinds of glyph symbols in the layout model editor. These will show up in the drawing editor palette. This xml file (stationsymbols.xml) can be placed in a plugin or just copied into your ~/.unidata/idv/DefaultIdv directory. (Note: if you are not running the latest nightly build of the IDV (after October 15th, 2008) then the directory is ~/.metapps/DefaultIdv) Since we are in the 3D world you can create shapes with a set of lines, a set of triangles or a set of quadrilaterals. Each symbol tag contains: The shapetype can be one of: line triangle quad The points attribute is a set of comma separated points (x,y,z) that define a number of shapes. The number of points is dependent on the shapetype. For example, the line shapetype defines a set of line segments so you need 2 points for each line segment. For triangle shapetype you need 3 points. For quad you need 4. The scale allows you to set the scale The icon is just the icon used in the layout model editor Note: When you are working on creating a symbol you need to restart the IDV every time you change this file. Also, the layout model you create with a shape defined here will contain the original points from when you created the layout model. So, you need to delete the shape glyph and re-add it Note: we don't handle errors very well when instantiating a shape from the xml. So, if you create a shape in the layout model editor and nothing happens look for a stack trace print out. --> <symbol class="ucar.unidata.ui.symbol.ShapeSymbol" points="-1.0,-1.0,0.0, 1.0,-1.0,0.0, -1.0,0.0,0.0, 1.0,0.0,-1.0, -1.0,1.0,0.0, 1.0,1.0,0.0" shapetype="line" name="Three horizontal lines" icon="/auxdata/ui/icons/Shape16.gif" stretchy="true" /> <symbol class="ucar.unidata.ui.symbol.ShapeSymbol" scale="1.5" points="-1.0,-0.25,0.0, -0.75,-0.25,0.0, -0.75,0.25,0.0, -1.0,0.25,0.0, -0.125,-0.25,0.0, 0.125,-0.25,0.0, 0.125,0.25,0.0, -0.125,0.25,0.0, 1.0,-0.25,0.0, 0.75,-0.25,0.0, 0.75,0.25,0.0, 1.0,0.25,0.0 " shapetype="quad" name="Filled rectangles" icon="/auxdata/ui/icons/Shape16.gif" stretchy="true" /> </symbols>
idvdevelopers
archives: