Skip to content

Commit

Permalink
Ported graphic drawing from internal control.
Browse files Browse the repository at this point in the history
Implemented addShape & and added example.
  • Loading branch information
Ryan committed Jun 1, 2011
1 parent c64e7c0 commit 6973325
Show file tree
Hide file tree
Showing 12 changed files with 3,677 additions and 138 deletions.
2 changes: 2 additions & 0 deletions Makedos.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ echo jquery-geo-%1.js does not include jQuery itself but does include
echo the jQuery UI widget factory

type js\jquery.geo.head.js > docs\jquery-geo-%1.js
type js\excanvas.js >> docs\jquery-geo-%1.js
type js\jquery.mousewheel.min.js >> docs\jquery-geo-%1.js
type js\jquery.ui.widget.js >> docs\jquery-geo-%1.js
type js\jquery.geo.core.js >> docs\jquery-geo-%1.js
type js\jquery.geo.geographics.js >> docs\jquery-geo-%1.js
type js\jquery.geo.geomap.js >> docs\jquery-geo-%1.js

echo Minifying build
Expand Down
9 changes: 6 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@ Documentation is hosted at http://host.appgeo.com/libs/geo/test/

== TO DO ==

* geographics - Document graphics widget
* geomap - Document and implement the refresh method
* docs/internal - Document how geomap draws shapes
* geomap - Change getPixelSize docs to mention that it's a read-only method property (is there a better way in jQuery UI?) then rename it to pixelSize
* geomap - Auto-handle window resize events
* geomap - [BUG] Mouse wheel on bad or missing tile doesn't zoom out on first rotate
* geomap - Document and implement service-level shapes
* geomap - Document and implement passing a function to shapeStyle and addShape that returns a geomap style object based on feature or geometry properties
* geomap - Document and implement findShape's callback syntax
* graphics - See Modernizr for comment on BB Storm & canvas detection
* geographics - Document graphics widget

== CHANGELOG ==

=== Version alpha2 ===
* geomap - Support dynamic map services
* geomap - [BUG] geomap causes a script error if jQuery UI is already included
* geomap - Document graphic methods
* geomap - Document shape methods
* geomap - [BUG] Soft double-click does not work
* geomap - [BUG] Cannot see dev-supplied inner content if not set to rel/abs position
* geomap - Add mobile test page
* geographics - Port graphic code from internal control
* geomap - Implement non-service addShape method
* graphics - drawArc should use style's width and height and only take center as an argument

=== Version alpha1 ===
* Create interactive map widget
Expand Down
119 changes: 119 additions & 0 deletions docs/examples/addShape.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title>addShape test</title>
<style type="text/css">
body
{
font-family: Calibri,Arial;
}
label
{
display: block;
margin: .25em;
}
label span
{
cursor: pointer;
display: inline-block;
font-weight: bold;
width: 8em;
}
</style>
</head>
<body>
<div>
<h1>
addShape test</h1>
<p>
This page tests geomap's addShape method and some style options.</p>
<p>
A geomap widget is initialized to the continental US and a point is placed in Massachusetts. A line extends from MA to South Jersey where a triangle covers an area.</p>
<p>All the geometry is stored in a single GeometryCollection. We first draw the entire collection with a broad stroked, white style to create a halo effect behind the real shapes. This makes them a little easier to see on the map. Then we draw each individual shape again with color. The first two have the default style which is red. For the last one, we change the color to blue.</p>
<div id="map" style="float: left; width: 640px; height: 480px;">
</div>
<pre style="float: left;"><code>var map = $("#map").geomap({
center: [-94, 37],
zoom: 3
});

var gcol = {
type: &quot;GeometryCollection&quot;,
geometries: [
{
type: &quot;Point&quot;,
coordinates: [-71, 42]
},
{
type: &quot;LineString&quot;,
coordinates: [
[-71, 42],
[-75, 39.5]
]
},
{
type: &quot;Polygon&quot;,
coordinates: [[
[-75, 39.7],
[-74.8, 39.3],
[-75.2, 39.3],
[-75, 39.7]
]]
}
]
};

map.geomap(&quot;addShape&quot;, gcol, { strokeWidth: &quot;8px&quot;, color: &quot;#dedede&quot; });

map.geomap(&quot;addShape&quot;, gcol.geometries[0]);

map.geomap(&quot;addShape&quot;, gcol.geometries[1]);

map.geomap(&quot;addShape&quot;, gcol.geometries[2], { color: &quot;blue&quot; });</code></pre>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script src="http://host.appgeo.com/libs/geo/test/jquery-geo-test.min.js"></script>
<script>
$(function () {
var map = $("#map").geomap({
center: [-94, 37],
zoom: 3
});

var gcol = {
type: "GeometryCollection",
geometries: [
{
type: "Point",
coordinates: [-71, 42]
},
{
type: "LineString",
coordinates: [
[-71, 42],
[-75, 39.5]
]
},
{
type: "Polygon",
coordinates: [[
[-75, 39.7],
[-74.8, 39.3],
[-75.2, 39.3],
[-75, 39.7]
]]
}
]
};

map.geomap("addShape", gcol, { strokeWidth: "8px", color: "#dedede" });

map.geomap("addShape", gcol.geometries[0]);

map.geomap("addShape", gcol.geometries[1]);

map.geomap("addShape", gcol.geometries[2], { color: "#00d" });
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/geomap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>geomap | $.geo</title>
<meta name="description" content="$.geo geomap method">
<meta name="description" content="$.geo geomap widget">
<meta name="author" content="Ryan Westphal">
</head>

Expand Down
16 changes: 8 additions & 8 deletions docs/geomap/shapeStyle.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ <h2>geomap style</h2>
</tr>
<tr>
<td>color</td>
<td>black</td>
<td>#7f0000</td>
<td>An indirect, fallback value for the fill and stroke properties if they are not set.</td>
</tr>
<tr>
<td>fill</td>
<td>undefined</td>
<td>Draws the interior of a shape. The area to be drawn consists of any areas inside the outline of the shape. By default, fill will use the value of the color property.</td>
<td>Color to use when drawing the interior of a shape. The area to be drawn consists of any areas inside the outline of the shape. By default, fill will use the value of the color property.</td>
</tr>
<tr>
<td>fillOpacity</td>
<td>undefined</td>
<td>Specifies the opacity of the drawing operation used to draw the interior of a shape. By default, fillOpacity will use the value of the opacity property.</td>
<td>.2</td>
<td>Specifies the opacity of the drawing operation used to draw the interior of a shape. The final fill opacity also depends on the value of the opacity property.</td>
</tr>
<tr>
<td>height</td>
Expand All @@ -69,7 +69,7 @@ <h2>geomap style</h2>
<tr>
<td>opacity</td>
<td>1</td>
<td>An indirect, fallback value for the fillOpacity and strokeOpacity properties if they are not set.</td>
<td>The object opacity of the entire shape. This is a multiplicative operation when determining the final fillOpacity and strokeOpacity where any fill or stroke operation is made even more translucent if this values is below 1.0.</td>
</tr>
<tr>
<td>stroke</td>
Expand All @@ -79,12 +79,12 @@ <h2>geomap style</h2>
<tr>
<td>strokeOpacity</td>
<td>undefined</td>
<td>Specifies the opacity of the drawing operation used to draw the outline of a shape. By default, strokeOpacity will use the value of the opacity property.</td>
<td>Specifies the opacity of the drawing operation used to draw the outline of a shape. The final stroke opacity also depends on the value of the opacity property.</td>
</tr>
<tr>
<td>strokeWidth</td>
<td>&quot;1px&quot;</td>
<td>The width of the stroke of a shape. A zero value causes no stroke to be drawn.</td>
<td>&quot;2px&quot;</td>
<td>The width of the stroke of a shape. A zero value causes no stroke to be drawn. Currently only pixel values are allowed.</td>
</tr>
<tr>
<td>visibility</td>
Expand Down
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ <h4>component examples</h4>
<p>This first set of examples attempts to test various components of $.geo in an insolated way.</p>
<ul data-role=listview data-inset=true>
<li><a href="examples/simplest.html" rel=external>simplest</a></li>
<li><a href="examples/mobile.html" rel=external>mobile</a></li>
<li><a href="examples/proj.html" rel=external>proj</a></li>
<li><a href="examples/bbox.html" rel=external>bbox</a></li>
<li><a href="examples/center.html" rel=external>center &amp; zoom</a></li>
<li><a href="examples/tiledservices.html" rel=external>tiled services</a></li>
<li><a href="examples/shingledservices.html" rel=external>shingled (dynamic) services</a></li>
<li><a href="examples/tilingScheme.html" rel=external>tilingScheme</a></li>
<li><a href="examples/events.html" rel=external>events</a></li>
<li><a href="examples/addShape.html" rel=external>addShape</a></li>
</ul>
<h4>showcase</h4>
<p>This second set are more featured examples to show how other parts of your application can work with geomap. Some of these even try to implement slimmed-down versions of an existing applications.</p>
Expand Down
Loading

0 comments on commit 6973325

Please sign in to comment.