Package org.geotools.styling

Examples of org.geotools.styling.LinePlacement


    public LinePlacement build() {
        if (unset) {
            return null;
        }
        LinePlacement linePlacement = sf.linePlacement(offset, initialGap, gap, repeated, aligned,
                generalizedLine);
        if (parent == null) {
            reset();
        }
        return linePlacement;
View Full Code Here


      // it!
      if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("setting pointPlacement");
      }
      ts2d.setPointPlacement(false);
      LinePlacement p = (LinePlacement) placement;
      int displace = evalToInt(p.getPerpendicularOffset(), feature, 0);
      ts2d.setPerpendicularOffset(displace);
    }

    ts2d.setAnchorX(anchorX);
    ts2d.setAnchorY(anchorY);
View Full Code Here

                disp.setDisplacementY(rescale(disp.getDisplacementY(), uom));
                pointPlacement.setDisplacement(disp);
            }
        } else if (placement instanceof LinePlacement) {
            // rescales line label placement
            LinePlacement linePlacement = (LinePlacement) placement;
            linePlacement.setGap(rescale(linePlacement.getGap(), uom));
            linePlacement.setInitialGap(rescale(linePlacement.getInitialGap(), uom));
            linePlacement.setPerpendicularOffset(rescale(linePlacement.getPerpendicularOffset(),
                    uom));
        }
        copy.setLabelPlacement(placement);

        // rescale the halo
View Full Code Here

                    disp.setDisplacementY(rescale(disp.getDisplacementY()));
                    pointPlacement.setDisplacement(disp);
                }
            } else if (placement instanceof LinePlacement) {
                // rescales line label placement
                LinePlacement linePlacement = (LinePlacement) placement;
                linePlacement.setGap(rescale(linePlacement.getGap()));
                linePlacement.setInitialGap(rescale(linePlacement.getInitialGap()));
                linePlacement.setPerpendicularOffset(rescale(linePlacement.getPerpendicularOffset()));
            }
            copy.setLabelPlacement(placement);
           
            // rescale the halo
            if(copy.getHalo() != null) {
View Full Code Here

        pages.push(copy);
    }

    public void visit(LinePlacement lp) {
        Expression offset = copy( lp.getPerpendicularOffset());
        LinePlacement copy = sf.createLinePlacement(offset);
        copy.setAligned( lp.isAligned() );
        copy.setGap( copy(lp.getGap()) );
        copy.setGeneralized( lp.isGeneralizeLine() );
        copy.setInitialGap( copy(lp.getInitialGap()) );
        copy.setRepeated( lp.isRepeated() );

        if( STRICT && !copy.equals( lp )){
            throw new IllegalStateException("Was unable to duplicate provided LinePlacement:"+lp );
        }
        pages.push(copy);
    }
View Full Code Here

            textSymb.setUnitOfMeasure(uom);
           
            Font font = styleBuilder.createFont(new java.awt.Font("Verdana",java.awt.Font.PLAIN,fontSize));
            textSymb.setFont(font);
           
            LinePlacement placement = styleBuilder.createLinePlacement(perpOffset);
            placement.setGap(styleBuilder.literalExpression(gap));
            placement.setInitialGap(styleBuilder.literalExpression(initialGap));
           
            textSymb.setLabelPlacement(placement);
           
            visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);

            textSymb.accept(visitor);
            TextSymbolizer rescaledTextSymb = (TextSymbolizer) visitor.getCopy();
           
            double rescaledFontSize = rescaledTextSymb.getFont().getSize().evaluate(null, Double.class);
            LinePlacement rescaledPlacement = (LinePlacement) rescaledTextSymb.getLabelPlacement();
            double rescaledPerpOffset = rescaledPlacement.getPerpendicularOffset().evaluate(null, Double.class);
            double rescaledGap = rescaledPlacement.getGap().evaluate(null, Double.class);
            double rescaledInitialGap = rescaledPlacement.getInitialGap().evaluate(null, Double.class);
           
            assertEquals(Math.round(expectedRescaledFontSize), Math.round(rescaledFontSize));
            assertEquals(Math.round(expectedRescaledPerpOffset), Math.round(rescaledPerpOffset));
            assertEquals(Math.round(expectedRescaledGap), Math.round(rescaledGap));
            assertEquals(Math.round(expectedRescaledInitialGap), Math.round(rescaledInitialGap));
View Full Code Here

                ff.literal(12));
        assertEqualsContract(clone, other, halo);
    }

    public void testLinePlacement() throws Exception {
        LinePlacement linePlacement = sf.createLinePlacement(ff.literal(12));
       
        linePlacement.accept(visitor);
        LinePlacement clone = (LinePlacement) visitor.getCopy();;
       
        assertCopy(linePlacement, clone);

        LinePlacement other = sf.createLinePlacement(ff.property("NAME"));
        assertEqualsContract(clone, other, linePlacement);
    }
View Full Code Here

     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value) throws Exception {

        //<xsd:element minOccurs="0" ref="se:PerpendicularOffset"/>
        LinePlacement lp = (LinePlacement) super.parse(instance, node, value);
       
        //<xsd:element minOccurs="0" ref="se:IsRepeated"/>
        if (node.hasChild("IsRepeated")) {
            lp.setRepeated((Boolean) node.getChildValue("IsRepeated"));
        }
        //<xsd:element minOccurs="0" ref="se:InitialGap"/>
        if (node.hasChild("InitialGap")) {
            lp.setInitialGap((Expression)node.getChildValue("InitialGap"));
        }
        //<xsd:element minOccurs="0" ref="se:Gap"/>
        if (node.hasChild("Gap")) {
            lp.setGap((Expression)node.getChildValue("Gap"));
        }
        //<xsd:element minOccurs="0" ref="se:IsAligned"/>
        if (node.hasChild("IsAligned")) {
            lp.setAligned((Boolean) node.getChildValue("IsAligned"));
        }      
        //<xsd:element minOccurs="0" ref="se:GeneralizeLine"/>
        if (node.hasChild("GeneralizeLine")) {
            lp.setGeneralized((Boolean) node.getChildValue("GeneralizeLine"));
        }
       
        return lp;
    }
View Full Code Here

                Element e = value[i].getElement();
                if(elems[PERPENDICULAROFFSET].getName().equals(e.getName()))
                  offset = (Expression)value[i].getValue();
            }
         
          LinePlacement dlp = StyleFactoryFinder.createStyleFactory().createLinePlacement(offset);
          return dlp;
        }
View Full Code Here

      if (childName.equalsIgnoreCase("PerpendicularOffset")) {
        offset = parseCssParameter(child);
      }
    }

    LinePlacement dlp = factory.createLinePlacement(offset);

    return dlp;
  }
View Full Code Here

TOP

Related Classes of org.geotools.styling.LinePlacement

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.