Esempio n. 1
0
 /**
  * Sets a layer to a symbol in order to create a final symbol composed by different layers.
  *
  * @param layer
  */
 protected void setLayerToSymbol(ISymbol layer) {
   int i = getLayerManager().getSelectedLayerIndex();
   IMultiLayerSymbol s = (IMultiLayerSymbol) symbol;
   if (i >= 0 && i < s.getLayerCount()) {
     s.setLayer(s.getLayerCount() - 1 - i, layer);
   }
   refresh();
 }
Esempio n. 2
0
  /**
   * Constructor method
   *
   * @param symbol ISymbol
   * @param shapeType int
   */
  public SymbolEditor(ISymbol symbol, int shapeType) {
    //////////	/-------------------------------------
    if (shapeType == FShape.TEXT) {
      this.symbol = symbol == null ? new SimpleTextSymbol() : symbol;
    } else {
      //////////	/-------------------------------------

      if (!(symbol instanceof IMultiLayerSymbol)) {
        // this is a simple symbol (or null one); it will be
        // converted to a multilayer one to accept layer addition
        IMultiLayerSymbol nSym = SymbologyFactory.createEmptyMultiLayerSymbol(shapeType);

        if (!(symbol instanceof FSymbol)) nSym.addLayer(symbol);

        if (symbol instanceof CartographicSupport) {
          CartographicSupport cs = (CartographicSupport) symbol;
          CartographicSupport nCs = (CartographicSupport) nSym;
          nCs.setReferenceSystem(cs.getReferenceSystem());
          nCs.setUnit(cs.getUnit());
        }

        this.symbol = nSym;
      } else {
        this.symbol = symbol;
      }

      // apply units and reference system to comboboxes
      if (this.symbol instanceof CartographicSupport) {
        CartographicSupport cs = (CartographicSupport) this.symbol;
        getCmbUnits().setSelectedUnitIndex(cs.getUnit());
        getCmbUnitsReferenceSystem().setSelectedIndex(cs.getReferenceSystem());
      }
    }
    this.oldSymbolProperties = this.symbol.getXMLEntity();
    this.shapeType = shapeType;
    initialize();
  }