Package net.lucidviews.geoalgo.limb.data

Examples of net.lucidviews.geoalgo.limb.data.Options


    }
  }
 
  public Options read( Map<String,String> kvp ) throws ParameterValueException
  {
    Options options = new Options();
   
    Dimension2D screenSize = parseDimension( kvp );
    if (screenSize != null)
    {
      options.setScreenSize( screenSize );
    }
   
    String label = kvp.get( LABEL_PARAM );
    if (label != null)
    {
      options.setLabelFormat( label );
    }
   
    String propertiesToKeep = kvp.get( LIMB_PROPERTIES_PARAM );
    if (propertiesToKeep != null)
    {
      options.setLimbPropertiesToKeep( propertiesToKeep );
    }
   
    String negligibleDistance = kvp.get( NEGLIGIBLE_DISTANCE_PARAM );
    if (negligibleDistance != null)
    {
      try
      {
        options.setNegligibleDistance( Double.parseDouble( negligibleDistance ) );
      }
      catch (NumberFormatException e)
      {
        throw new ParameterValueException( "Invalid negligible distance '" + negligibleDistance + "'. Expected a numeric value.", e );
      }
    }
   
    String ignoreVisibleFeatures = kvp.get( IGNORE_VISIBLE_FEATURES_PARAM );
    if (ignoreVisibleFeatures != null)
    {
      options.setIgnoreVisibleFeatures( Boolean.parseBoolean( ignoreVisibleFeatures ) );
    }
   
    String searchDistance = kvp.get( SEARCH_DISTANCE_PARAM );
    if (searchDistance != null)
    {
      try
      {
        options.setOffTheMapDistance( Double.parseDouble( searchDistance ) );
      }
      catch (NumberFormatException e)
      {
        throw new ParameterValueException( "Invalid search distance '" + searchDistance + "'. Expected a numeric value.", e );
      }
View Full Code Here


    // Set the feature geometry and a label into the first polygon.
    GeometryAttribute featureGeometry = Utils.createGeometryAttribute( this.polygonGeomDescriptor, featurePolygon );
    this.feature1.setDefaultGeometryProperty( featureGeometry );
    this.feature1.setAttribute( NAME_ATTRIBUTE_NAME, featureName );
   
    Options options = new Options();
    options.setNegligibleDistance( 20.0 );
    options.setLabelFormat( NAME_ATTRIBUTE_NAME );
    options.setLimbPropertiesToKeep( "label,edges,intersection" );
   
    LimbGenerator testObj = new LimbGenerator();
    testObj.setIntersectionGeneratorClass( SimpleIntersectionGenerator.class );
    testObj.setIntersectionProcessors( Arrays.asList( new DiscardNegligibleIntersectionProcessor(),
                                                      new DiscardSmallerLineSegmentsIntersectionProcessor() ) );
View Full Code Here

   * @param request the request made to this service
   * @return options for processing that request, or <code>null</code> if not options are defined
   */
  protected Options getOptions( GetLimbsRequest request )
  {
    Options options;
   
    Options defaultOptions = this.defaultOptions.get( request.getAlgorithm() );
    if (defaultOptions != null)
    {
      options = defaultOptions.clone();
     
      if (request.getOptions() != null)
      {
        options.apply( request.getOptions() );
      }
View Full Code Here

      throw new LimbServiceException( "No layer was defined in the request." );
    }
   
    Geometry view = getViewGeometry( request );
    ILimbGenerator limbGenerator = getLimbGeneratior( request );
    Options options = getOptions( request );
   
    try
    {
      String layerName = request.getLayers().get( 0 );
      FeatureTypeInfo layer = getFeatureLayer( layerName );
View Full Code Here

  public void testPartlyVisibleFeature()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry lineFeature = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "500 500,500 1500" ) );
    Point expectedIntersectionPoint = this.geometryFactory.createPoint( new Coordinate( 500, 1000 ) );
    Options options = new Options();
    JustOffTheMapIntersectionGenerator testObj = new JustOffTheMapIntersectionGenerator();
    testObj.setShape( mapBounds );
    testObj.setDefaultOffTheMapDistance( 10.0 );
   
    // Ignore is on by default, which is used because no options are specified.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( null );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is off by default, which is used because no options are specified.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( null );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
   
    // Ignore is on by default, which is used because no specific option is specified.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( null );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is off by default, which is used because no specific option is specified.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( null );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
   
    // Ignore is turned on in the options.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( true );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is turned off in the options.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( false );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
  }
View Full Code Here

   *
   * @return whether to ignore features that are visible or partly visible
   */
  protected boolean getIgnoreVisibleFeatures()
  {
    Options options = this.getOptions();
    if (options == null)
    {
      return getDefaultIgnoreVisibleFeatures();
    }
    else
    {
      Boolean ignoreVisibleFeaturesOption = options.getIgnoreVisibleFeatures();
      if (ignoreVisibleFeaturesOption == null)
      {
        return getDefaultIgnoreVisibleFeatures();
      }
      else
View Full Code Here

   *
   * @return the distance to search
   */
  protected double getOffTheMapDistance()
  {
    Options options = this.getOptions();
    if (options == null)
    {
      return getDefaultOffTheMapDistance();
    }
    else
    {
      Double offTheMapDistance = options.getOffTheMapDistance();
      if (offTheMapDistance == null)
      {
        return getDefaultOffTheMapDistance();
      }
      else
View Full Code Here

TOP

Related Classes of net.lucidviews.geoalgo.limb.data.Options

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.