public static synchronized JContextTree getContextTree() {
    if (tree == null) {
      final JContextTree tree = new JContextTree();

      // search available popup menu items
      Lookup lk = Lookups.forPath("/Puzzle/ContextTree/Actions");
      for (TreePopupItem item : lk.lookupAll(TreePopupItem.class)) {
        tree.controls().add(item);
      }

      final List<PropertyPane> configPanes = new ArrayList<PropertyPane>();

      JPropertyTree propertyTree = new JPropertyTree();

      DefaultMutableTreeNode root = new DefaultMutableTreeNode();

      // search available property panels
      lk = Lookups.forPath("/Puzzle/ContextTree/PropertyPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        root.add(new DefaultMutableTreeNode(p));
      }

      // search filter panels
      DefaultMutableTreeNode filterNodes =
          new DefaultMutableTreeNode(CoreResource.getString("filter"));
      lk = Lookups.forPath("/Puzzle/ContextTree/FilterPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        filterNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(filterNodes);

      // search style panels
      DefaultMutableTreeNode styleNodes =
          new DefaultMutableTreeNode(CoreResource.getString("symbology"));
      lk = Lookups.forPath("/Puzzle/ContextTree/StylePanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        styleNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(styleNodes);

      if (!tree.controls().isEmpty()) {
        tree.controls().add(new SeparatorItem());
      }

      LayerPropertyItem property = new LayerPropertyItem(root);
      tree.controls().add(property);

      tree.revalidate();
      tree.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      ContextTreeTopComponent.tree = tree;
    }
    return tree;
  }
示例#2
0
  private void initTree(final JContextTree tree) {

    LayerFeatureItem item = new LayerFeatureItem();
    item.actions().add(new ClearSelectionAction());
    item.actions().add(new DeleteSelectionAction());

    tree.controls().add(item);
    tree.controls().add(new NewGroupItem());
    tree.controls().add(new ZoomToLayerItem());
    tree.controls().add(new SeparatorItem());
    tree.controls().add(new SessionCommitItem());
    tree.controls().add(new SessionRollbackItem());
    tree.controls().add(new SeparatorItem());
    tree.controls().add(new DeleteItem());
    tree.controls().add(new SeparatorItem());

    LayerPropertyItem property = new LayerPropertyItem();
    List<PropertyPane> lstproperty = new ArrayList<PropertyPane>();
    lstproperty.add(new LayerGeneralPanel());
    lstproperty.add(new JLayerCRSPane());
    lstproperty.add(new JLayerDataStructurePanel());

    LayerFilterPropertyPanel filters = new LayerFilterPropertyPanel();
    filters.addPropertyPanel(MessageBundle.format("filter"), new JCQLPropertyPanel());
    lstproperty.add(filters);

    LayerStylePropertyPanel styles = new LayerStylePropertyPanel();
    styles.addPropertyPanel(MessageBundle.format("analyze"), new JSimpleStylePanel());
    styles.addPropertyPanel(
        MessageBundle.format("analyze_vector"), new JClassificationSingleStylePanel());
    styles.addPropertyPanel(
        MessageBundle.format("analyze_vector"), new JClassificationIntervalStylePanel());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JColorMapPane());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JCellSymbolizerPane());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JIsolineSymbolizerPane());
    styles.addPropertyPanel(MessageBundle.format("sld"), new JAdvancedStylePanel());
    styles.addPropertyPanel(MessageBundle.format("sld"), new JSLDImportExportPanel());
    lstproperty.add(styles);

    property.setPropertyPanels(lstproperty);

    tree.controls().add(property);
    tree.controls().add(new ContextPropertyItem());

    tree.revalidate();
  }
示例#3
0
  protected JMap2DFrame(final MapContext context, boolean statefull, Hints hints) {
    initComponents();

    guiContextTree = (JContextTree) jScrollPane1;
    guiContextTree.setContext(context);
    initTree(guiContextTree);

    guiMap2D = new JMap2D(statefull);
    guiMap2D.getContainer().setContext(context);
    guiMap2D
        .getCanvas()
        .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    guiMap2D.getCanvas().setRenderingHint(GO2Hints.KEY_GENERALIZE, GO2Hints.GENERALIZE_ON);
    guiMap2D
        .getCanvas()
        .setRenderingHint(GO2Hints.KEY_BEHAVIOR_MODE, GO2Hints.BEHAVIOR_PROGRESSIVE);

    guiChainEditor = new JChainEditor(true);
    panETL.add(BorderLayout.CENTER, guiChainEditor);

    if (hints != null) {
      guiMap2D.getCanvas().setRenderingHints(hints);
    }

    guiMap2D.getCanvas().setAutoRepaint(true);

    for (TreePopupItem item : guiContextTree.controls()) {
      item.setMapView(guiMap2D);
    }

    try {
      Envelope env = context.getAreaOfInterest();
      if (env != null) {
        guiMap2D.getCanvas().setObjectiveCRS(env.getCoordinateReferenceSystem());
      } else {
        env = context.getBounds();
        guiMap2D.getCanvas().setObjectiveCRS(context.getCoordinateReferenceSystem());
      }
      if (env != null) {
        guiMap2D.getCanvas().setVisibleArea(env);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    // 2D map
    guiMap2D.addDecoration(
        new JClassicNavigationDecoration(JClassicNavigationDecoration.THEME.CLASSIC));
    panMap2D.add(BorderLayout.CENTER, guiMap2D);
    guiNavBar.setMap(guiMap2D);
    guiInfoBar.setMap(guiMap2D);
    guiCoordBar.setMap(guiMap2D);
    guiConfigBar.setMap(guiMap2D);
    guiSelectionBar.setMap(guiMap2D);
    guiEditBar.setMap(guiMap2D);
    guiMap2D.getCanvas().setAutoRepaint(true);
    guiMap2D.setHandler(new PanHandler(guiMap2D, false));

    // 3D map
    guiMap3D = new JMap3D();
    ((ContextContainer3D) guiMap3D.getMap3D().getContainer()).setContext(context);
    panMap3D.add(BorderLayout.CENTER, guiMap3D);

    setSize(1024, 768);
    setLocationRelativeTo(null);
  }