Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createPoint()


                Object[] values = new Object[fieldNames.size() - 1];

                String[] lineSplit = line.split(separator);
                double x = Double.parseDouble(lineSplit[xIndex]);
                double y = Double.parseDouble(lineSplit[yIndex]);
                Point point = gf.createPoint(new Coordinate(x, y));
                values[0] = point;

                int objIndex = 1;
                for( int i = 0; i < lineSplit.length; i++ ) {
                    if (i == xIndex || i == yIndex) {
View Full Code Here


    @Before
    public void setUp() throws Exception {
        handler=new TestHandler();
        map=(Map) handler.getContext().getMap();
        GeometryFactory fac=new GeometryFactory();
        Point geom=fac.createPoint(new Coordinate(-564121,-1632497));
        SimpleFeature[] feature = UDIGTestUtil.createTestFeatures("test", new Point[]{geom}, new String[]{"name"}, CRS.decode("EPSG:2065")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Layer layer = map.getLayerFactory().createLayer(CatalogTests.createGeoResource(feature, true));
        map.getLayersInternal().add( layer );
        map.getViewportModelInternal().setCRS(DefaultGeographicCRS.WGS84);
        map.getViewportModelInternal().zoomToBox(layer.getBounds(null, map.getViewportModel().getCRS()));
View Full Code Here

     * Test method for 'org.locationtech.udig.tools.edit.commands.CreateOrSetFeature.run(IProgressMonitor)'
     */
    @Test
    public void testCreateNew() throws Exception {
        GeometryFactory fac=new GeometryFactory();
        fac.createPoint(new Coordinate(10,10));
        CreateNewOrSelectExitingFeatureCommand command=new CreateNewOrSelectExitingFeatureCommand("newID", layer, fac.createPoint(new Coordinate(10,10))); //$NON-NLS-1$
        command.setMap(map);
        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        command.run(nullProgressMonitor);
       
View Full Code Here

     */
    @Test
    public void testCreateNew() throws Exception {
        GeometryFactory fac=new GeometryFactory();
        fac.createPoint(new Coordinate(10,10));
        CreateNewOrSelectExitingFeatureCommand command=new CreateNewOrSelectExitingFeatureCommand("newID", layer, fac.createPoint(new Coordinate(10,10))); //$NON-NLS-1$
        command.setMap(map);
        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        command.run(nullProgressMonitor);
       
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
View Full Code Here

     * Test method for 'org.locationtech.udig.tools.edit.commands.CreateOrSetFeature.run(IProgressMonitor)'
     */
    @Test
    public void testModifyExistingFeature() throws Exception {
        GeometryFactory fac=new GeometryFactory();
        fac.createPoint(new Coordinate(10,10));
        CreateNewOrSelectExitingFeatureCommand command=new CreateNewOrSelectExitingFeatureCommand(original.getID(), layer, fac.createPoint(new Coordinate(10,10)));
        command.setMap(map);
        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        command.run(nullProgressMonitor);
       
View Full Code Here

     */
    @Test
    public void testModifyExistingFeature() throws Exception {
        GeometryFactory fac=new GeometryFactory();
        fac.createPoint(new Coordinate(10,10));
        CreateNewOrSelectExitingFeatureCommand command=new CreateNewOrSelectExitingFeatureCommand(original.getID(), layer, fac.createPoint(new Coordinate(10,10)));
        command.setMap(map);
        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        command.run(nullProgressMonitor);
       
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
View Full Code Here

  final GeometryFactory geomFactory = polygonGeometry.getFactory();

  boolean allOutside = true;
  for (int i = 0; i < coordinates.length; i++) {

      Point point = geomFactory.createPoint(coordinates[i]);
      // check the points is inside the polygon.
      // if some one is inside, will return.
      if (polygonGeometry.contains(point)) {
    allOutside = false;
    break;
View Full Code Here

      // that point.
      // If not... TODO find a solution if not.
      newPt = GeometryUtil.intersection(offset0.p0, offset0.p1, offset1.p0, offset1.p1);

      GeometryFactory gf = new GeometryFactory();
      Point closestPoint = gf.createPoint(offset0.closestPoint(newPt));

      // calculate the distance
      double distance1 = offset0.distance(closestPoint.getCoordinate());
      double distance2 = offset1.distance(closestPoint.getCoordinate());
View Full Code Here

        GeometryFactory geometryFactory = new GeometryFactory();
        if( lat != -1 && lon != -1 ){
            double x = Double.valueOf( row[lon]);
            double y = Double.valueOf( row[lat]);
            Coordinate coordinate = new Coordinate(x,y);
            return geometryFactory.createPoint( coordinate );
        }
        else {
            return null; // point not available
        }
    }
View Full Code Here

    public void setUp() throws Exception {
        sourceType=DataUtilities.createType("source", "*geom:LineString,geom2:Point,nAme:String"); //$NON-NLS-1$ //$NON-NLS-2$
        sourceFeatures = new SimpleFeature[1];
        GeometryFactory fac=new GeometryFactory();
        Object[] values = new Object[]{builder.safeCreateGeometry(LineString.class, new Coordinate[]{new Coordinate(10,10), new Coordinate(20,10), new Coordinate(20,20)}),
                fac.createPoint(new Coordinate(10,10)), "sourceName"};
    sourceFeatures[0]=SimpleFeatureBuilder.build(sourceType, values,"id2"); //$NON-NLS-1$
        sourceResource=CatalogTests.createGeoResource(sourceFeatures, true);
        sourceMap=MapTests.createNonDynamicMapAndRenderer(sourceResource, new Dimension(100,100));

        targetType=DataUtilities.createType("target", "*targetGeom:Point,name:String"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.