com.micello.mapapi.data
Class MStyle

java.lang.Object
  extended by com.micello.mapapi.data.MStyle

public class MStyle
extends java.lang.Object

This class holds the styling information for rendering a geometry. This includes the body color, the outline color and width and the text color.

There are three main types of geometry on the map. Area geometry has a fill color given by the body color and an stroke given by outline width and outline color. Line is rendered as a stroke, with a color given by the body color and a width given by the outline width. Linear area geometry is rendered as a stroke with the color given by the body color and the width defined by the geometry itself. The width for a linear geometry represents an actual phyiscal width, as opposed to the width in a line geometry which is purely symbolic.

To configure the paint objects for these different geometry, some initialization methods should be called before an object is rendered: configGeomCoordType to set the object type and configPhysicalWidth or configStrokeWidth to set the stroke characteristics.


Constructor Summary
MStyle(java.lang.Integer bodyColor, java.lang.Integer outlineColor, float outlineWidth, java.lang.Integer textColor)
          Constructor.
 
Method Summary
 void configGeomCoordType(int type)
          This method should be called before rendering to make sure the body color is properly configured
 void configPhysicalWidth(float width)
          This method configures the render width to match a physical width in map coordinates.
 void configStrokeWidth(float zoomScale, boolean useOutlinePaint)
          This method configures the render width to match a fixed stroke width, accounting for the current zoom scale.
 Paint getBodyPaint()
          This mehod returns that paint that should be used for the body.
 Paint getOutlinePaint()
          This method returns the paint that should be used for the outline.
 Paint getTextPaint()
          This method returns the paint that should be used for the text.
 boolean hasWidth()
          This method returns true if the style has an outline associated with it.
static MStyle load(JSONObject json)
          This method loads the style from a JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MStyle

public MStyle(java.lang.Integer bodyColor,
              java.lang.Integer outlineColor,
              float outlineWidth,
              java.lang.Integer textColor)
Constructor. Set body color, outline color or text color to null if no body/outline/text is wanted.

Method Detail

getBodyPaint

public Paint getBodyPaint()
This mehod returns that paint that should be used for the body.


getOutlinePaint

public Paint getOutlinePaint()
This method returns the paint that should be used for the outline.


getTextPaint

public Paint getTextPaint()
This method returns the paint that should be used for the text.


hasWidth

public boolean hasWidth()
This method returns true if the style has an outline associated with it.


configPhysicalWidth

public void configPhysicalWidth(float width)
This method configures the render width to match a physical width in map coordinates.


configStrokeWidth

public void configStrokeWidth(float zoomScale,
                              boolean useOutlinePaint)
This method configures the render width to match a fixed stroke width, accounting for the current zoom scale.


configGeomCoordType

public void configGeomCoordType(int type)
This method should be called before rendering to make sure the body color is properly configured


load

public static MStyle load(JSONObject json)
                   throws java.lang.Exception
This method loads the style from a JSON object.

Throws:
java.lang.Exception