示例#1
0
  /**
   * Reset the visual style of the selected elements.
   *
   * <p>TODO Does not work with lists (F.S.)
   */
  private void applyDefaults() {
    GeoElement geo;
    ConstructionDefaults defaults = kernel.getConstruction().getConstructionDefaults();

    for (int i = 0; i < selectionList.size(); ++i) {
      geo = (GeoElement) selectionList.get(i);
      defaults.setDefaultVisualStyles(geo, true);
      geo.updateRepaint();
    }

    propPanel.updateSelection(selectionList.toArray());
  }
 protected void setMaxLayerUsed(GeoElement geo, Application app) {
   // update only if  not a 3D object
   // if (!geo.isGeoElement3D())
   super.setMaxLayerUsed(geo, app);
 }
  public void createDefaultGeoElements() {
    super.createDefaultGeoElements();

    // angle
    GeoAngle3D angle = new GeoAngle3D(cons);
    angle.setVisualStyle(super.getDefaultGeo(DEFAULT_ANGLE));
    angle.setAngleStyle(GeoAngle.ANGLE_ISNOTREFLEX);
    defaultGeoElements.put(DEFAULT_ANGLE3D, angle);

    // free point
    GeoPoint3D freePoint = new GeoPoint3D(cons);
    freePoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    freePoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    freePoint.setLocalVariableLabel("Point3D" + strFree);
    freePoint.setObjColor(colPoint);
    // freePoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_FREE, freePoint);

    // dependent point
    GeoPoint3D depPoint = new GeoPoint3D(cons);
    depPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    depPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    depPoint.setLocalVariableLabel("Point3D" + strDependent);
    depPoint.setObjColor(colDepPoint);
    // depPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_DEPENDENT, depPoint);

    // point on path
    GeoPoint3D pathPoint = new GeoPoint3D(cons);
    pathPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    pathPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    pathPoint.setLocalVariableLabel("Point3DOn");
    pathPoint.setObjColor(colPathPoint);
    // pathPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_ON_PATH, pathPoint);

    // point in region
    GeoPoint3D regionPoint = new GeoPoint3D(cons);
    regionPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    regionPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    regionPoint.setLocalVariableLabel("Point3DInRegion");
    regionPoint.setObjColor(colRegionPoint);
    // regionPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_IN_REGION, regionPoint);

    // line
    GeoLine3D line = new GeoLine3D(cons);
    // line.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    line.setLocalVariableLabel("Line3D");
    defaultGeoElements.put(DEFAULT_LINE3D, line);

    // segment
    GeoSegment3D segment = new GeoSegment3D(cons);
    // segment.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    segment.setLocalVariableLabel("Segment3D");
    defaultGeoElements.put(DEFAULT_SEGMENT3D, segment);

    // ray
    GeoRay3D ray = new GeoRay3D(cons);
    // ray.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    ray.setLocalVariableLabel("Ray3D");
    defaultGeoElements.put(DEFAULT_RAY3D, ray);

    // line intersection
    GeoLine3D lineIntersection = new GeoLine3D(cons);
    // line.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    lineIntersection.setLocalVariableLabel("Line3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_LINE3D_INTERSECTION, lineIntersection);

    // segment intersection
    GeoSegment3D segmentIntersection = new GeoSegment3D(cons);
    // segment.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    segmentIntersection.setLocalVariableLabel("Segment3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_SEGMENT3D_INTERSECTION, segmentIntersection);

    // ray intersection
    GeoRay3D rayIntersection = new GeoRay3D(cons);
    // ray.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    rayIntersection.setLocalVariableLabel("Ray3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_RAY3D_INTERSECTION, rayIntersection);

    // axis
    GeoAxis3D axis = new GeoAxis3D(cons);
    // axis.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_SHORT);
    axis.setLocalVariableLabel("Axis3D");
    defaultGeoElements.put(DEFAULT_AXIS3D, axis);

    // vector 3D
    GeoVector3D vector = new GeoVector3D(cons);
    // vector.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    vector.setObjColor(colVector);
    vector.setLocalVariableLabel("Vector3D");
    defaultGeoElements.put(DEFAULT_VECTOR3D, vector);

    // conic
    GeoConic3D conic = new GeoConic3D(cons);
    conic.setLocalVariableLabel("Conic3D");
    // conic.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    conic.setObjColor(colConic3D);
    defaultGeoElements.put(DEFAULT_CONIC3D, conic);

    // conic intersection
    GeoConic3D conicIntersection = new GeoConic3D(cons);
    conicIntersection.setLocalVariableLabel("Conic3D" + strIntersection);
    conicIntersection.setObjColor(colIntersectionCurve);
    defaultGeoElements.put(DEFAULT_CONIC3D_INTERSECTION, conicIntersection);

    // curve
    GeoCurveCartesian3D curve = new GeoCurveCartesian3D(cons);
    curve.setLocalVariableLabel("Curve3D");
    // curve.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    curve.setObjColor(colCurveCartesian3D);
    defaultGeoElements.put(DEFAULT_CURVECARTESIAN3D, curve);

    // plane
    GeoPlane3D plane = new GeoPlane3D(cons);
    plane.setLocalVariableLabel("Plane3D");
    plane.setObjColor(colPlane3D);
    plane.setAlphaValue(DEFAULT_PLANE3D_ALPHA);
    plane.setLineThickness(DEFAULT_PLANE3D_GRID_THICKNESS);
    plane.setFading(DEFAULT_PLANE3D_FADING);
    // plane.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_SHORT);
    defaultGeoElements.put(DEFAULT_PLANE3D, plane);

    // polygon
    GeoPolygon3D polygon = new GeoPolygon3D(cons, null, null, false);
    polygon.setLocalVariableLabel("Polygon3D");
    polygon.setObjColor(colPolygon3D);
    polygon.setAlphaValue(DEFAULT_POLYGON3D_ALPHA);
    defaultGeoElements.put(DEFAULT_POLYGON3D, polygon);

    // polyhedron
    GeoPolyhedron polyhedron = new GeoPolyhedron(cons);
    polyhedron.setLocalVariableLabel("Polyhedron");
    polyhedron.setObjColor(colPolyhedron);
    polyhedron.setAlphaValue(DEFAULT_POLYGON3D_ALPHA);
    defaultGeoElements.put(DEFAULT_POLYHEDRON, polyhedron);

    // quadric
    GeoQuadric3D quadric = new GeoQuadric3D(cons);
    quadric.setLocalVariableLabel("Quadric");
    quadric.setObjColor(colQuadric);
    quadric.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_QUADRIC, quadric);

    // limited quadric
    GeoQuadric3D limitedQuadric = new GeoQuadric3D(cons);
    limitedQuadric.setLocalVariableLabel("QuadricLimited");
    limitedQuadric.setObjColor(colPolyhedron);
    limitedQuadric.setAlphaValue(DEFAULT_QUADRIC_LIMITED_ALPHA);
    defaultGeoElements.put(DEFAULT_QUADRIC_LIMITED, limitedQuadric);

    // function n var
    GeoFunctionNVar function = new GeoFunctionNVar(cons);
    function.setLocalVariableLabel("function");
    function.setObjColor(colQuadric);
    function.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_FUNCTION_NVAR, function);

    // surface
    GeoSurfaceCartesian3D surface = new GeoSurfaceCartesian3D(cons);
    surface.setLocalVariableLabel("surface");
    surface.setObjColor(colQuadric);
    surface.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_SURFACECARTESIAN3D, surface);
  }