org.zkoss.gmaps
Class Gpolyline

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.gmaps.Gpolyline
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Mapitem, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.sys.ComponentCtrl
Direct Known Subclasses:
Gpolygon

public class Gpolyline
extends org.zkoss.zul.impl.XulElement
implements Mapitem

Google Maps support Gpolyline.

Since:
2.0_6
Author:
henrichen
See Also:
Serialized Form

Nested Class Summary
protected static class Gpolyline.Tuple
           
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl
 
Field Summary
protected  java.lang.String _encodedLevels
           
protected  java.lang.String _encodedPolyline
           
protected  java.util.List _points
           
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
Gpolyline()
           
 
Method Summary
 void addPoint(double lat, double lng, int level)
          Add polyline axix point.
protected  int e5(double db)
           
protected static java.lang.String encodeInt(int x)
           
protected static java.lang.String encodeLatLng(int e5)
           
 java.lang.String getColor()
          Line color in form of #RRGGBB, default to #808080.
 java.lang.String getEncodedLevels()
           
 java.lang.String getEncodedPolyline()
           
 int getNumLevels()
          Returns the number of polyline levels.
 int getOpacity()
          line opacity 0 - 100, default to 50.
 java.lang.String getOuterAttrs()
          Returns the HTML attributes for this tag.
 int getWeight()
          line weight(width) 1 - 10, default to 5.
 int getZoomFactor()
          Returns the zoomFactor (zoomFactor change per the numLevels).
 boolean isChildable()
          Default: not childable.
 void setColor(java.lang.String color)
          Line color in form of #RRGGBB, default to #808080.
 void setNumLevels(int numLevels)
          Sets the number of polyline levels.
 void setOpacity(int opacity)
          line opacity 0 - 100, default to 50.
 void setPoints(java.lang.String points)
          Set polyline in lat,lng,level tuple(double, double, int); e.g.
 void setWeight(int weight)
          line weight(width) 1 - 10, default to 5.
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setPopup, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getDraggable, getDroppable, getHeight, getLeft, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZIndex, newExtraCtrl, setClass, setDraggable, setDroppable, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addMoved, addSharedAnnotationMap, addSharedEventHandlerMap, appendAsapAttr, appendChild, applyProperties, clone, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getEventHandler, getExtraCtrl, getFellow, getFellowIfAny, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getMoldURI, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getPropagatee, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, invalidate, isAsapRequired, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, onWrongValue, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, appendChild, applyProperties, clone, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, invalidate, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, smartUpdate, smartUpdateDeferred, unsetVariable
 

Field Detail

_points

protected java.util.List _points

_encodedPolyline

protected java.lang.String _encodedPolyline

_encodedLevels

protected java.lang.String _encodedLevels
Constructor Detail

Gpolyline

public Gpolyline()
Method Detail

addPoint

public void addPoint(double lat,
                     double lng,
                     int level)
Add polyline axix point.

Note the polyline "level" does not correspond directly to a zoom level but they are related. More accurately, the numLevels parameter divides up the existing zoom levels (currently 18) into groups of zoom levels and polyline level is confined by the numLevels. For example, the default numLevels value is 4, so the polyline level can be 0 to 3 only. The Google maps zoom levels are grouped together into the following 4 levels (determined by numLevels):

Polyline LevelZoom Levels
Level 0Zoom levels 0-5
Level 1Zoom levels 6-10
Level 2Zoom levels 11-14
Level 3Zoom levels 15-18

An polyline level value of 3 in this case would ensure that a point appears in all zoom level, while a level of 0 will ignore points specified beyond zoom level 5. The endpoints of a polyline should often be set to the largest encoded level, to ensure that the endpoints will appear in all zoom levels and the line is drawn correctly.

A general rule is that whenever the level of the end point is greater or equal to the current Gmaps level, that end point is appeared; otherwise, it should be skipped.

Parameters:
lat - the latitude
lng - the longtitude
level - the polyline level(default to 0 - 3)

setPoints

public void setPoints(java.lang.String points)
Set polyline in lat,lng,level tuple(double, double, int); e.g. "lat1,lng1,level1,lat2,lng2,level2,lat3,lng3,level3, ...".

Parameters:
points -

getEncodedPolyline

public java.lang.String getEncodedPolyline()

e5

protected int e5(double db)

getEncodedLevels

public java.lang.String getEncodedLevels()

encodeLatLng

protected static java.lang.String encodeLatLng(int e5)

encodeInt

protected static java.lang.String encodeInt(int x)

getOuterAttrs

public java.lang.String getOuterAttrs()
Returns the HTML attributes for this tag.

Used only for component development, not for application developers.

Overrides:
getOuterAttrs in class org.zkoss.zul.impl.XulElement

getColor

public java.lang.String getColor()
Line color in form of #RRGGBB, default to #808080.

Returns:
the color

setColor

public void setColor(java.lang.String color)
Line color in form of #RRGGBB, default to #808080.

Parameters:
color - the color to set

getWeight

public int getWeight()
line weight(width) 1 - 10, default to 5.

Returns:
the weight

setWeight

public void setWeight(int weight)
line weight(width) 1 - 10, default to 5.

Parameters:
weight - the weight to set

getOpacity

public int getOpacity()
line opacity 0 - 100, default to 50.

Returns:
the opacity
Since:
2.0_7

setOpacity

public void setOpacity(int opacity)
line opacity 0 - 100, default to 50.

Parameters:
opacity - the line opacity to set
Since:
2.0_7

getNumLevels

public int getNumLevels()
Returns the number of polyline levels.

Returns:
the number of polyline levels.

setNumLevels

public void setNumLevels(int numLevels)
Sets the number of polyline levels.

Parameters:
numLevels - the number of levels.

getZoomFactor

public int getZoomFactor()
Returns the zoomFactor (zoomFactor change per the numLevels).


isChildable

public boolean isChildable()
Default: not childable.

Specified by:
isChildable in interface org.zkoss.zk.ui.Component
Overrides:
isChildable in class org.zkoss.zk.ui.AbstractComponent


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.