public void addButton(final ToolboxDialog toolbox) {
    if (!selectSelectItemsByCircleButtonAdded) {

      MouseEvent event =
          new MouseEvent(
              toolbox, MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), 0, 0, 0, 1, true);
      toolbox.getContext();
      QuasimodeTool sit =
          new QuasimodeTool(new SelectItemsByCircleTool(toolbox.getContext()))
              .add(new QuasimodeTool.ModifierKeySpec(true, false, false), null);
      sit.mousePressed(event);
      toolbox.add(sit);
      toolbox.finishAddingComponents();
      toolbox.validate();
      selectSelectItemsByCircleButtonAdded = true;
    }
  }
Exemplo n.º 2
0
 protected void initializeToolbox(ToolboxDialog toolbox) {
   try {
     toolbox.setIconImage(icon.getImage());
     final JConsole console = new JConsole();
     console.setPreferredSize(new Dimension(430, 240));
     console.print(
         I18N.get("ui.plugin.BeanShellPlugIn.the-workbenchcontext-may-be-referred-to-as-wc"));
     console.print(
         I18N.get(
             "ui.plugin.BeanShellPlugIn.warning-pasting-in-multiple-statements-may-cause-the-application-to-freeze"));
     toolbox.getCenterPanel().add(console, BorderLayout.CENTER);
     Interpreter interpreter = new Interpreter(console);
     interpreter.setClassLoader(
         toolbox.getContext().getWorkbench().getPlugInManager().getClassLoader());
     interpreter.set("wc", toolbox.getContext());
     interpreter.eval("setAccessibility(true)");
     interpreter.eval("import com.vividsolutions.jts.geom.*");
     interpreter.eval("import com.vividsolutions.jump.feature.*");
     new Thread(interpreter).start();
   } catch (EvalError e) {
     toolbox.getContext().getErrorHandler().handleThrowable(e);
   }
 }
 public void addButton(final PlugInContext context) {
   if (!circleButtonAdded) {
     final ToolboxDialog toolbox =
         ((EditingPlugIn) context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY))
             .getToolbox(context.getWorkbenchContext());
     QuasimodeTool quasimodeTool =
         new QuasimodeTool(DrawConstrainedCircleTool.create(toolbox.getContext()));
     quasimodeTool.add(new QuasimodeTool.ModifierKeySpec(true, false, false), null);
     quasimodeTool.add(new QuasimodeTool.ModifierKeySpec(true, true, false), null);
     toolbox.add(quasimodeTool, null);
     toolbox.finishAddingComponents();
     toolbox.validate();
     circleButtonAdded = true;
   }
 }
Exemplo n.º 4
0
  public boolean execute(PlugInContext context) throws Exception {
    if (context.getLayerViewPanel() == null) return false;
    this.networkMgr = NetworkModuleUtilWorkbench.getNetworkManager(context);
    configProperties = new CalcRutaConfigFileReaderWriter();
    if (configProperties.getRedesNames() == null) {
      context
          .getLayerViewPanel()
          .getContext()
          .warnUser(
              I18N.get("calcruta", "routeengine.calcularruta.errormessage.emptyconfiguration"));
      return false;
    }
    this.context = context;
    nodesInfo = new HashMap<Integer, VirtualNodeInfo>();
    configuatorNetworks = new HashMap<String, Network>();

    nodesFeatureCol = AddNewLayerPlugIn.createBlankFeatureCollection();
    nodesFeatureCol.getFeatureSchema().addAttribute("nodeId", AttributeType.INTEGER);

    if (context.getLayerManager().getLayer("Puntos para TSP") != null) {
      context.getLayerManager().remove(sourcePointLayer);
    }

    sourcePointLayer = context.addLayer("Puntos TSP", "Puntos para TSP", nodesFeatureCol);

    //		LabelStyle labelStyle = new LabelStyle();
    //		labelStyle.setAttribute("nodeId");
    //		labelStyle.setColor(Color.black);
    //		labelStyle.setScaling(false);
    //		labelStyle.setEnabled(true);
    //		sourcePointLayer.addStyle(labelStyle);

    if (networkMgr == null) {
      context.getLayerViewPanel().getContext().warnUser("Error en el NetworkManager.");
      return false;
    }

    if (networkMgr.getNetworks().isEmpty()) {
      context
          .getLayerViewPanel()
          .getContext()
          .warnUser("No hay redes cargadas en el NetworkManager");
      return false;
    }

    if (configProperties.getRedesNames().length <= 0) {
      context
          .getLayerViewPanel()
          .getContext()
          .warnUser("Error en la configuracion. Inicie el configurador de rutas");
    }

    String redes[] = configProperties.getRedesNames();
    for (int i = 0; i < redes.length; i++) {
      configuatorNetworks.put(
          redes[i], ((LocalGISNetworkManager) networkMgr).getAllNetworks().get(redes[i]));
    }
    for (int m = 0; m < configuatorNetworks.values().size(); m++) {
      if (configuatorNetworks.values().toArray()[m] == null) {
        context
            .getLayerViewPanel()
            .getContext()
            .warnUser("Error en la configuracion. Inicie el configurador de rutas");
        return false;
      }
    }

    ToolboxDialog toolbox = new ToolboxDialog(context.getWorkbenchContext());
    //		toolbox.add();
    //
    //		RouteEngineDrawPointTool.createCursor(IconLoader.icon("bandera.gif").getImage());
    context
        .getLayerViewPanel()
        .setCurrentCursorTool(RouteEngineTSPDrawPointTool.create(toolbox.getContext()));

    return false;
  }