C# Class Rock.Web.UI.Controls.GeoPicker

This control will create a Google map with drawring tools that allows the user to define a single point or a polygon which forms a geo-fence depending on the Rock.Web.UI.Controls.GeoPicker.ManagerDrawingMode.Point. To use on a page or usercontrol: ]]> To set an initial value: gpGeoPoint.SetValue( DbGeography.FromText("POINT(-122.335197 47.646711)") ); To access the value after it's been set use the SelectedValue property: DbGeography point = gpGeoPoint.SelectedValue; If you wish to set an appropriate, initial center point you can use the CenterPoint property.
Inheritance: System.Web.UI.WebControls.CompositeControl, IRockControl
Afficher le fichier Open project: SparkDevNetwork/Rock Class Usage Examples

Private Properties

Свойство Type Description
ConvertPointFromWellKnownText string
ConvertPointToWellKnownText string
ConvertPolyFromWellKnownText string

Méthodes publiques

Méthode Description
ConvertPolyToWellKnownText ( string latCommaLongPipe ) : string

Convert string from "lat1,long1|lat2,long2|..." to Well Known Text (WKT) http://en.wikipedia.org/wiki/Well-known_text format "POLYGON(( long1 lat1, long2 lat2, ...))". It is expected that the input is a single polygon (not a polygon with an inner polygon). It will also correct the orientation (clockwise-ness) of the points because DbGeography needs them to be in counter-clockwise order.

GeoPicker ( ) : System

Initializes a new instance of the GeoPicker class.

IsClockwisePolygon ( PointF polygon ) : bool

Attempt to determine if the polygon is clockwise or counter-clockwise. Thank you dominoc! http://dominoc925.blogspot.com/2012/03/c-code-to-determine-if-polygon-vertices.html

RenderBaseControl ( System.Web.UI.HtmlTextWriter writer ) : void

Renders the base control.

RenderControl ( System.Web.UI.HtmlTextWriter writer ) : void

Outputs server control content to a provided T:System.Web.UI.HtmlTextWriter object and stores tracing information about the control if tracing is enabled.

SetValue ( System.Data.Entity.Spatial.DbGeography dbGeography ) : void

Sets the value. Necessary to preload the geo fence or geo point.

Méthodes protégées

Méthode Description
CreateChildControls ( ) : void

Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

OnInit ( EventArgs e ) : void

Raises the E:System.Web.UI.Control.Init event.

RegisterJavaScript ( ) : void

Registers the java script.

btnSelect_Click ( object sender, EventArgs e ) : void

Handles the Click event of the btnSelect control.

Private Methods

Méthode Description
ConvertPointFromWellKnownText ( string wkt ) : string

Convert from WKT format: "POINT (long1 lat1)" to "lat1,long1"

ConvertPointToWellKnownText ( string latCommaLong ) : string

Converts single coordinate set (lat,long) into the Well Known Text (WKT) POINT format. http://en.wikipedia.org/wiki/Well-known_text

ConvertPolyFromWellKnownText ( string wkt ) : string

Convert from WKT format: "POLYGON ((long1 lat1, long2 lat2, ...))" to "lat1,long1|lat2,long2|..."

Method Details

ConvertPolyToWellKnownText() public static méthode

Convert string from "lat1,long1|lat2,long2|..." to Well Known Text (WKT) http://en.wikipedia.org/wiki/Well-known_text format "POLYGON(( long1 lat1, long2 lat2, ...))". It is expected that the input is a single polygon (not a polygon with an inner polygon). It will also correct the orientation (clockwise-ness) of the points because DbGeography needs them to be in counter-clockwise order.
public static ConvertPolyToWellKnownText ( string latCommaLongPipe ) : string
latCommaLongPipe string string of "lat1,long1|lat2,long2|..."
Résultat string

CreateChildControls() protected méthode

Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
protected CreateChildControls ( ) : void
Résultat void

GeoPicker() public méthode

Initializes a new instance of the GeoPicker class.
public GeoPicker ( ) : System
Résultat System

IsClockwisePolygon() public static méthode

Attempt to determine if the polygon is clockwise or counter-clockwise. Thank you dominoc! http://dominoc925.blogspot.com/2012/03/c-code-to-determine-if-polygon-vertices.html
public static IsClockwisePolygon ( PointF polygon ) : bool
polygon System.Drawing.PointF
Résultat bool

OnInit() protected méthode

Raises the E:System.Web.UI.Control.Init event.
protected OnInit ( EventArgs e ) : void
e System.EventArgs An object that contains the event data.
Résultat void

RegisterJavaScript() protected méthode

Registers the java script.
protected RegisterJavaScript ( ) : void
Résultat void

RenderBaseControl() public méthode

Renders the base control.
public RenderBaseControl ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter The writer.
Résultat void

RenderControl() public méthode

Outputs server control content to a provided T:System.Web.UI.HtmlTextWriter object and stores tracing information about the control if tracing is enabled.
public RenderControl ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter The object that receives the control content.
Résultat void

SetValue() public méthode

Sets the value. Necessary to preload the geo fence or geo point.
public SetValue ( System.Data.Entity.Spatial.DbGeography dbGeography ) : void
dbGeography System.Data.Entity.Spatial.DbGeography The db geography.
Résultat void

btnSelect_Click() protected méthode

Handles the Click event of the btnSelect control.
protected btnSelect_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
Résultat void