wiki:HowToAddANewGeoElement
Last modified 2 months ago Last modified on 03/26/12 00:49:57
  • create a new GeoXXX class eg kernel.GeoPolygon
    • note that copy() should not set label of the object
  • create a new DrawXXX class eg euclidian.DrawPolygon
  • Create a new AlgoXXX class eg kernel.AlgoPolygon
  • plain.properties - you must email this change to translation@… otherwise it will get overwritten in SVN by the automatic translation system
    Polygon=Polygon 
    
  • in GeoElement:
     public static final int GEO_CLASS_POLYGON = 17;
    
    	getDrawingPriority()
    		case  GEO_CLASS_POLYGON :
    			typePriority = 50; break;
    

Default naming, if appropriate...

			else if (isGeoPolygon()) {
				int counter = 0;
				String str;
				do {
					counter++;
					str = app.getPlain("Name.polygon") + kernel.internationalizeDigits(counter+"");;
				} while (!cons.isFreeLabel(str));
				return str;

... and in plain.properties you must email this change to translation@… otherwise it will get overwritten in SVN by the automatic translation system

Name.polygon=poly
  • in EuclidianView
    		case GeoElement.GEO_CLASS_POLYGON:
    			d = new DrawPolygon(this, (GeoPolygon) geo);
    			break;
    
  • ConstructionDefaults.getDefaultType()
    		case GeoElement.GEO_CLASS_POLYGON: 
    			type = DEFAULT_POLYGON;
    			break;
    
    		// polygon
    		GeoPolygon polygon = new GeoPolygon(cons, null);	
    //		polygon.setLocalVariableLabel(app.getPlain("Polygon"));
    		polygon.setLocalVariableLabel("Polygon");
    		polygon.setObjColor(colPolygon);
    		polygon.setAlphaValue(DEFAULT_POLYGON_ALPHA);
    		defaultGeoElements.put(DEFAULT_POLYGON, polygon);
    
  • check if change needed in EuclidianController.removeParentPoints()
  • check if change needed in AlgoMacro.initSpecialReferences()
  • check if change needed in GeoElement.hasMoveableInputPoints()
  • check if change needed in Macro.initMacro()

XML stuff

 Kernel.createGeoElement()
    		case 'p': // point, polygon
    			...
    			else if (type.equals("polygon"))
    				return new GeoPolygon(cons, null);

Options

Add to Options -> Defaults