コード例 #1
0
 @SuppressWarnings("nls")
 private void setExternalGraphicPath(String externalGraphicPath, ExternalGraphic extGraphic)
     throws MalformedURLException {
   URL url = null;
   File f = new File(externalGraphicPath);
   String format = Utilities.getFormat(externalGraphicPath);
   if (!f.exists()) {
     if (externalGraphicPath.startsWith("http://") || externalGraphicPath.startsWith("file:")) {
       url = new URL(externalGraphicPath);
     }
   }
   if (url == null) {
     url = f.toURI().toURL();
     if (externalGraphicPath.equals("")) {
       url = new URL("file:");
     }
   }
   extGraphic.setLocation(url);
   extGraphic.setFormat(format);
 }
コード例 #2
0
  @Override
  public void createPageContent(Composite parent) {

    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    stackLayout = new StackLayout();
    mainComposite.setLayout(stackLayout);

    noFeatureLabel = new Label(mainComposite, SWT.NONE);
    noFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    noFeatureLabel.setText(Messages.SimplePointEditorPage_0);

    StyleLayer layer = getSelectedLayer();
    IGeoResource resource = layer.getGeoResource();
    if (resource.canResolve(FeatureSource.class)) {
      StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
      oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
      if (oldStyle == null) {
        oldStyle = Utilities.createDefaultPointStyle();
      }

      DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
      dsv.visit(oldStyle);
      style = (Style) dsv.getCopy();

      if (isPointStyle(style)) {
        propertiesEditor = new PointPropertiesEditor(layer);
        propertiesEditor.open(mainComposite, style);
        stackLayout.topControl = propertiesEditor.getControl();
      } else {
        stackLayout.topControl = noFeatureLabel;
      }
    } else {
      stackLayout.topControl = noFeatureLabel;
    }
  }
コード例 #3
0
  public void refresh() {
    Layer layer = getSelectedLayer();
    IGeoResource resource = layer.getGeoResource();
    if (!resource.canResolve(FeatureSource.class)) {
      return;
    }

    StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
    oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
    if (oldStyle == null) {
      oldStyle = Utilities.createDefaultPointStyle();
    }
    DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
    dsv.visit(oldStyle);
    style = (Style) dsv.getCopy();

    if (!isPointStyle(style)) {
      stackLayout.topControl = noFeatureLabel;
    } else {
      stackLayout.topControl = propertiesEditor.getControl();
      propertiesEditor.updateStyle(style);
    }
    mainComposite.layout();
  }
コード例 #4
0
 public void setDash(String dash) {
   this.dash = dash;
   checkStrokeExists();
   float[] dashArray = Utilities.getDash(dash);
   stroke.setDashArray(dashArray);
 }
コード例 #5
0
 public void setOffset(String xOffset, String yOffset) {
   this.xOffset = xOffset;
   this.yOffset = yOffset;
   Utilities.setOffset(symbolizer, xOffset + "," + yOffset); // $NON-NLS-1$
 }