Package org.geomajas.plugin.geocoder.command.dto

Examples of org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative


    matchedResponse = new GetLocationForStringResponse();
    matchedResponse.setLocationFound(true);

    alternativesResponse = new GetLocationForStringResponse();
    List<GetLocationForStringAlternative> list = new ArrayList<GetLocationForStringAlternative>();
    list.add(new GetLocationForStringAlternative());
    list.add(new GetLocationForStringAlternative());
    alternativesResponse.setAlternatives(list);
  }
View Full Code Here


      for (GetLocationResult[] altArr : alternatives) {
        for (GetLocationResult alt : altArr) {
          if (maxAlternatives > 0 && maxAlternatives <= altList.size()) {
            break;
          }
          GetLocationForStringAlternative one = new GetLocationForStringAlternative();

          String matchedLocation = location;
          List<String> matchedStrings = alt.getCanonicalStrings();
          if (null != matchedStrings) {
            matchedLocation = splitGeocoderStringService.combine(matchedStrings);
          }
          one.setCanonicalLocation(matchedLocation);

          // set additional info data
          one.setGeocoderName(alt.getGeocoderName());
          one.setUserData(alt.getUserData());

          // combine location envelopes
          Bbox bbox = dtoConverterService.toDto(alt.getEnvelope());
          one.setBbox(bbox);
          one.setCenter(
              new Coordinate(bbox.getX() + bbox.getWidth() / 2, bbox.getY() + bbox.getHeight() / 2));

          altList.add(one);
        }
      }
View Full Code Here

    Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
    GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
    Assert.assertFalse(response.isLocationFound());
    Assert.assertNotNull(response.getAlternatives());
    Assert.assertTrue(response.getAlternatives().size() > 0);
    GetLocationForStringAlternative alt = response.getAlternatives().get(0);
    Assert.assertEquals(-0.12574, alt.getCenter().getX(), DELTA);
    Assert.assertEquals(51.50853, alt.getCenter().getY(), DELTA);
    Assert.assertEquals("GeoNames", alt.getGeocoderName());
  }
View Full Code Here

    Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
    GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
    Assert.assertFalse(response.isLocationFound());
    Assert.assertNotNull(response.getAlternatives());
    Assert.assertTrue(response.getAlternatives().size() > 0);
    GetLocationForStringAlternative alt = response.getAlternatives().get(0);
    Assert.assertEquals(-13997.312772346217, alt.getCenter().getX(), DELTA);
    Assert.assertEquals(6711744.580491004, alt.getCenter().getY(), DELTA);
    Assert.assertEquals("GeoNames", alt.getGeocoderName());
  }
View Full Code Here

  }

  private ListGridRecord[] toRecords(List<GetLocationForStringAlternative> alternatives) {
    ListGridRecord[] records = new ListGridRecord[alternatives.size()];
    for (int i = 0; i < records.length; i++) {
      GetLocationForStringAlternative alt = alternatives.get(i);
      ListGridRecord record = new ListGridRecord();

      record.setAttribute(LOCATION_FIELD, alt.getCanonicalLocation());
      record.setAttribute(LOCATION_OBJECT, alt);

      records[i] = record;
    }
    return records;
View Full Code Here

    private GeocoderRecordClickHandler(GeocoderWidget widget) {
      this.widget = widget;
    }

    public void onRecordClick(RecordClickEvent recordClickEvent) {
      GetLocationForStringAlternative alternative;
      alternative = (GetLocationForStringAlternative) recordClickEvent.getRecord()
          .getAttributeAsObject(LOCATION_OBJECT);
      widget.fireEvent(new SelectLocationEvent(widget.getMap(), alternative));
    }
View Full Code Here

TOP

Related Classes of org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative

Copyright © 2018 www.massapicom. 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.