Created
April 3, 2013 07:30
-
-
Save gordonbanderson/5299125 to your computer and use it in GitHub Desktop.
Example of drawing a red/green/blue triangle around a given map coordinate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Render a triangle around the provided lat,lon, zoom from the editing functions, | |
*/ | |
public function MapWithLines() { | |
$map = $this->owner->getRenderableMap(); | |
$map->setZoom( $this->ZoomLevel ); | |
$map->setAdditionalCSSClasses( 'fullWidthMap' ); | |
$map->setShowInlineMapDivStyle( true ); | |
$scale = 0.3; | |
// draw a triangle | |
$point1 = array( | |
$this->Lat - 0.5*$scale, $this->Lon | |
); | |
$point2 = array( | |
$this->Lat + 0.5*$scale, $this->Lon-0.7*$scale | |
); | |
$point3 = array( | |
$this->Lat + 0.5*$scale, $this->Lon+0.7*$scale | |
); | |
$map->addLine( $point1, $point2 ); | |
$map->addLine( $point2, $point3, '#000077' ); | |
$map->addLine( $point3, $point1, '#007700' ); | |
return $map; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment