예제 #1
0
  /**
   * @param app application
   * @param view view
   * @param selectedGeos selected geos
   * @param geos geos
   * @param location place to show
   */
  public ContextMenuChooseGeoD(
      AppD app,
      EuclidianView view,
      ArrayList<GeoElement> selectedGeos,
      ArrayList<GeoElement> geos,
      Point location,
      GPoint invokerLocation) {

    super(app, selectedGeos, location);

    this.view = view;
    this.selectedGeos = selectedGeos;

    // return if just one geo, or if first geos more than one
    if (
    /* geos.size()<2 || */ selectedGeos.size() > 1) {
      justOneGeo = false;
      return;
    }

    justOneGeo = true;

    // section to choose a geo
    // addSeparator();
    createSelectAnotherMenu(view.getMode());

    this.loc = invokerLocation;
    this.geos = geos;

    GeoElement geoSelected = selectedGeos.get(0);

    // add geos
    geoAddedForSelectAnother = false;

    metas = new TreeSet<GeoElement>();

    for (GeoElement geo : geos) {
      if (geo != geoSelected) { // don't add selected geo
        addGeo(geo);
      }

      if (geo.getMetasLength() > 0) {
        for (GeoElement meta : ((FromMeta) geo).getMetas()) {
          if (!metas.contains(meta)) {
            addGeo(meta);
          }
        }
      }
    }

    if (geoAddedForSelectAnother) {
      addSelectAnotherMenu();
    }

    // TODO: clear selection is not working from here
    this.getWrappedPopup().getSelectionModel().clearSelection();
  }
예제 #2
0
 /**
  * @param view view
  * @param points start point and end point
  */
 public DrawVector(EuclidianView view, ArrayList<GeoPointND> points) {
   this.view = view;
   this.points = points;
   geo =
       view.getKernel()
           .getConstruction()
           .getConstructionDefaults()
           .getDefaultGeo(ConstructionDefaults.DEFAULT_VECTOR);
   updatePreview();
 }
예제 #3
0
  /**
   * Creates new drawable for slope
   *
   * @param view view
   * @param slope slope number
   */
  public DrawSlope(EuclidianView view, GeoNumeric slope) {
    this.view = view;
    kernel = view.getKernel();
    this.slope = slope;
    geo = slope;

    slope.setDrawable(true);

    // get parent line
    init();
    update();
  }