Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Super Contributor
Posts: 301
Registered: ‎02-10-2016

Create custom symbology for feature in storage

HI team,

 

I create a GMSC plugin that use temporary storage; however, I don't know how to create symbology for the feature, we want the symbology to be map scale independent. I follow an example and use image for the symbology but the the image scales when the map scale changes. 

 

Appreciate all the suggestions and ideas

 

Kind regards,

Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Create custom symbology for feature in storage

[ Edited ]

Hi team, 

 

Here is the detail on how I do create custom symbology for temporary feature. I use svg for feature and construct an instance of GPrimitive on the fly.

 

ImageIcon MARKER_IMAGEICON = BatikUtils.loadIcon(DisplayCoordinateValuePlugin.class, "location_2.svg", new Dimension(128,128));


	private void OutputCoordinateFromStorage(GPrimitive coordinateGPrimitive)
	{			
				
		try 
			{
			 	GBounds bound = new  GBounds(coordinateGPrimitive.getBounds().getCenter().getX() - MARKER_IMAGEICON.getIconWidth()/2d,
			 			coordinateGPrimitive.getBounds().getCenter().getY() ,
			 			coordinateGPrimitive.getBounds().getCenter().getX() + MARKER_IMAGEICON.getIconWidth()/2d,
			 			coordinateGPrimitive.getBounds().getCenter().getY() + MARKER_IMAGEICON.getIconHeight());
			    
			 	GPrimitive updatedcoordinateGPrimitive =  new GImage(new GAction(FIXED_ID), MARKER_IMAGEICON.getImage(), bound);			
				getTemp(null).update(updatedcoordinateGPrimitive);
				getTemp(null).getFeature().setVisible(true);
			}
			catch (StorageException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
		
	}

 

However, the symbology is pixelized and I have to increase the icon size to make it look better. I believe I need to create a proper style for the feature but I don't know how.

 

1.png

 

 

Appreciate all the suggestions and ideas on this matter.

 

Kind regards,

 

 

Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Create custom symbology for feature in storage

Hi team,

 

I make some progress by using FeatureTypeStyleFactory object to create a style as follows:

 

IFeatureTypeStyle styleLocal = FeatureTypeStyleFactory.createPointStyle(Color.RED, 30.0, Uom.PIXEL);	 	
			 	
			 	
			    
			 	GPrimitive updatedcoordinateGPrimitive =  new GPoint(new GAction(UUID.randomUUID(),"My tooltip text"), styleLocal , coordinateGPrimitive.getBounds().getCenter());		
			 	

However, for point, it always draw a cross and what we can change is color and size. I just wonder whether I can make use of an image such as the anchor above, but it needs to be not pixelized and scale independant.

 

Appreciate all suggestions and ideas,

 

Kind regards,

 

 

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.