arcgissamples\cartography\propertypage\MZPropertyPage.java—ArcObjects 10.4 Help for Java | ArcGIS for Desktop
MZ renderer
arcgissamples\cartography\propertypage\MZPropertyPage.java
/* Copyright 2015 ESRI
* 
* All rights reserved under the copyright laws of the United States
* and applicable international laws, treaties, and conventions.
* 
* You may freely redistribute and use this sample code, with or
* without modification, provided you include the original copyright
* notice and use restrictions.
* 
* See the use restrictions at <your ArcGIS install location>/DeveloperKit10.4/userestrictions.txt.
* 
*/
package arcgissamples.cartography.propertypage;

import java.io.IOException;

import javax.swing.JFrame;

import arcgissamples.cartography.MZRenderer;

import com.esri.arcgis.carto.IFeatureRenderer;
import com.esri.arcgis.cartoUI.BaseCustomRendererPropertyPage;
import com.esri.arcgis.interop.AutomationException;
import com.esri.arcgis.interop.extn.ArcGISCategories;
import com.esri.arcgis.interop.extn.ArcGISExtension;

@ArcGISExtension(categories = {ArcGISCategories.ESRIRendererPropertyPages})
public class MZPropertyPage extends BaseCustomRendererPropertyPage {

  MZPropertyPageUI mzPropertyPageUI;

  @Override
  public void apply(IFeatureRenderer arg0) {

    try {
      String orientation = mzPropertyPageUI.jCmbLabelOrientation.getSelectedItem().toString();
      if (orientation.equals("Along")) {
        ((MZRenderer) arg0).setLabelOrientation(0);
        ((MZRenderer) arg0).setMarkerOrientation(0);
      } else if (orientation.equals("Horizontal")) {
        ((MZRenderer) arg0).setLabelOrientation(1);
        ((MZRenderer) arg0).setMarkerOrientation(1);
      } else if (orientation.equals("Perpendicular")) {
        ((MZRenderer) arg0).setLabelOrientation(2);
        ((MZRenderer) arg0).setMarkerOrientation(2);
      }

      ((MZRenderer) arg0).setLabelInterval(Integer.parseInt(mzPropertyPageUI.jCmbLabelInterval.getSelectedItem().toString()));
      if (mzPropertyPageUI.jrdMeasures.isSelected()) {
        ((MZRenderer) arg0).setRenderMode(0);
      } else {
        ((MZRenderer) arg0).setRenderMode(1);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  @Override
  public Class getCustomRendererDef() {
    return MZRenderer.class;
  }

  @Override
  public String getDescription() throws IOException, AutomationException {
    return "MZ Renderer Property Page";
  }

  @Override
  public String getName() throws IOException, AutomationException {
    return "MZRenderer";
  }

  @Override
  public int getPreviewImage() throws IOException, AutomationException {
    return 0;
  }

  @Override
  public String getType() throws IOException, AutomationException {
    return "MZ Renderer";
  }

  public JFrame initGUI(IFeatureRenderer arg0) {
    try {
      try {
        mzPropertyPageUI = new MZPropertyPageUI();
      } catch (Exception e) {
        e.printStackTrace();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return mzPropertyPageUI;
  }

  @Override
  public int getPriority() throws IOException, AutomationException {
    return 0;
  }
}