| Author |
Comment/Response |
Michael
|
06/29/12 7:34pm
In Response To 'Re: Re: PointSize' --------- Here's a better way: Find a bounding polygon (a rectangle); reverse the inside polygon (switches inside and outside); stitch together with bounding polygon.
A little tricky because a country's polygon is really a list of polygons. I didn't think it would work because of the edges that connect the polygons, but Mathematica treats them as zero width; so it works! I hope the code is not mysterious.
Stitch[inPolys_, outPoly_] :=
Fold[Function[{out, in},
Join[out, {out[[1]], in[[1]]}, Reverse[in]]
], outPoly, inPolys];
Manipulate[
Module[{ctry, bBox, padding, plRange},
ctry = CountryData["Spain", "Polygon"][[1]];
padding = 0.25;(* to make bBox larger *)
plRange = ({Min[#1], Max[#1]} &) /@ Transpose[Join @@ ctry];
bBox = Tuples[
plRange + {{-padding, padding}, {-padding, padding}}][[{1, 3, 4,
2}]];
Graphics[{(*Coordinate of the point at {-3.71`,40.42`}.*)
Red, {PointSize[pointSize],
Point[{-3.71`,
40.42`}]},(*Border of country whit polygon*)
{RGBColor[0.9,
0.9, 0.9], Polygon@Stitch[ctry, bBox]}},
Background -> RGBColor[0.4, 0.4, 0.4], PlotRange -> plRange,
PlotRangePadding -> 0.2, PlotRangeClipping -> True]], {pointSize,
0, 1}]
URL: , |
|