Thanks Ede, it works and I learned how to use []...
I am considering also an alternative: to read directly a wkt file and
convert it to a geometry. I will dig on WKTReader class


2016-02-12 17:14 GMT+01:00 <[email protected]>:

> it needs an array of holes, even if it's only one hole.. try (not compile
> tested)
>
> GeometryFactory gf = new GeometryFactory();
> LinearRing hole = gf.createLinearRing(new Coordinate[] {
> new Coordinate(0D, 0D),
> new Coordinate(0D, 2D),
> new Coordinate(2D, 2D),
> new Coordinate(2D, 0D),
> new Coordinate(0D, 0D) });
> LinearRing shell = gf.createLinearRing(new Coordinate[] {
> new Coordinate(0D, 0D),
> new Coordinate(0D, 4D),
> new Coordinate(4D, 4D),
> new Coordinate(4D, 0D),
> new Coordinate(0D, 0D) });
>
> Polygon p = gf.createPolygon( shell, new LinearRing[]{ hole });
>
> not that i didn't reverse the direction (coord order) of the hole. there
> was some rule that shells run clockwise and holes anti-clockwise, or the
> other way around. you probably know that better than me.
>
> ..ede
>
> On 12.02.2016 16:58, Giuseppe Aruta wrote:
> > Yes,
> > but I don't know to use is the parameter LinearRing[] holes.
> > Do you know a sample?
> >
> > 2016-02-12 16:51 GMT+01:00 <[email protected]>:
> >
> >> did you try GeometryFactory's
> >>
> >>  createPolygon(LinearRing shell, LinearRing[] holes)
> >>
> >>
> >>
> http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/GeometryFactory.html#createPolygon%28com.vividsolutions.jts.geom.LinearRing,%20com.vividsolutions.jts.geom.LinearRing[]%29
> >>
> >> already?
> >>
> >> ..ede
> >>
> >> On 12.02.2016 16:47, Giuseppe Aruta wrote:
> >>> Hi list,
> >>> I need a help.
> >>> I am trying to develop some tools that automatically draw a shape
> >> (polygon)
> >>> on the workbench view. I want to use to automatize some shape drawing
> >>> whenever I know that I have to transfer a gis file to cad (for instance
> >> to
> >>> create blocks)
> >>>
> >>> I was likely able to draw simple shapes, for instance:
> >>> a polygon((0 0, 0 4, 4 4, 4 0, 0 0) (4*4 dimension)  needs a simple
> code
> >>> like:
> >>> new GeometryFactory().createLinearRing(
> >>>                     new Coordinate[] {
> >>>                     new Coordinate(0D, 0D),
> >>>                     new Coordinate(0D, 4D),
> >>>                     new Coordinate(4D, 4D),
> >>>                     new Coordinate(4D, 0D),
> >>>                     new Coordinate(0D, 0D) }),
> >>>                   * nul*l);
> >>>
> >>> But I found some difficulties when I want to draw a polygon with one or
> >>> more hole,
> >>> hpw can I handle the parameter *null* (LinearRing[]) on the previous
> >> code?
> >>> For instance, how can I draw a polygon of 4*4 with 2*2 hole in the
> >> middle?
> >>> I didn't find any example.
> >>> Thank you in advance for the answer
> >>> Peppe
> >>>
> >>>
> >>>
> >>>
> >>
> ------------------------------------------------------------------------------
> >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> >>> Monitor end-to-end web transactions and take corrective actions now
> >>> Troubleshoot faster and improve end-user experience. Signup Now!
> >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Jump-pilot-devel mailing list
> >>> [email protected]
> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> >> Monitor end-to-end web transactions and take corrective actions now
> >> Troubleshoot faster and improve end-user experience. Signup Now!
> >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> >> _______________________________________________
> >> Jump-pilot-devel mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Site24x7 APM Insight: Get Deep Visibility into Application Performance
> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > Monitor end-to-end web transactions and take corrective actions now
> > Troubleshoot faster and improve end-user experience. Signup Now!
> > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> >
> >
> >
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Jump-pilot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to