DrGeo object model
Last updated at 12:06 pm UTC on 17 October 2018
Notes about the object model of DrGeo
See also DrGeo use case elements
DrGeo application model
The DrGeo application model holds references to:
- the domain, the geometric items constituting the sketch
- the costumes, the views of the geometric items
- the presenter, the way for the user to interact with the application
- isNotInteractive, it indicates if the app is under the user interaction or
is used by the system (for example to load a sketch), in that case no user interactions are authorized.
To instantiate an application, do:
- 'DrGeo new' for a complete application
- 'DrGeo applicationToolbarless' for an app without the toolbar
- service mode, view without any UI element
From the developer mailing list (Oct 2018)
DrGMathItem instances and their inter-dependencies make the geometric model. They are managed by a factory, DrGFactory which is held in the domain object.
DrGeoCanvas
The main object to start constructing a sketch with the Smalltalk language is called DrGeoCanvas
Object subclass: #DrGeoCanvas
instanceVariableNames: 'drgeo'
classVariableNames: ''
package: 'DrGeoII-Core-Script'
DrGeo use case: constructing a sketch
DrGeoWindow
A DrGeoWindow object is the view which is hold by a DrGeo canvas object.
StandardWindow subclass: #DrGeoWindow
instanceVariableNames: 'app area statusbar sideContainer macroMenu scriptMenu tree'
classVariableNames: ''
package: 'DrGeoII-UI-Window'
DrGDrawable
PasteUpMorph subclass: #DrGDrawable
| canvas |
canvas := DrGeoCanvas new.
canvas view area inspect
Result: a DrGDrawable which is a subclass of PasteUpMorph.
DrGMathItem objects
see DrGeo object model: Math items hierarchy
Builder
Object subclass: #DrGMathItemBuilder
instanceVariableNames: 'point actionMap app flyingItem flyingCostume movingPoint'
classVariableNames: ''
package: 'DrGeoII-Core-Builder'
class comment:
This is the root class of the MathBuilder hierarchy responsible to create new mathematic items.
A builder instance is specialized to build one type of object: free point, constrained point, line, segment, transformed mathItem...
To effectively build a new mathItem, the builder need to be fed with mathItem with the add: message.
At any time it is possible to check wheter the build process is terminated or not with the readyToBuild message.
Related patterns: BUILD, TEMPLATE METHOD
ProtoObject #()
Object #()
DrGMathItemBuilder #(#point #actionMap #app #flyingItem #flyingCostume #movingPoint)
DrGAngleBuilder #(#pointA #pointB #pointC #vectorA #vectorB)
DrGArcBuilder #(#pointA #pointB #pointC)
DrGArcCenterBuilder #(#center #origin #extremity)
DrGBitmapBuilder #()
DrGCloneBuilder #(#item)
DrGCoordinatesBuilder #(#pointA #vector #circle #line)
DrGDummyBuilder #()
DrGFlyPointBuilder #(#curveItemA #curveItemB)
DrGFreePointBuilder #(#curveItem)
DrGLocusBuilder #(#freePoint #constrainedPoint)
DrGMacroBuilder #(#wizard #input #output #description #title)
DrGMacroPlayer #(#wizard #selectedMacro #input)
DrGMacroPlayerHeadless #()
DrGMiddleBuilder #(#pointA #pointB #segment)
DrGPointByCoordinatesBuilder #(#valueX #valueY #script)
DrGPointIntersectionBuilder #(#curveItemA #curveItemB)
DrGPolygonBuilder #(#points)
DrGPolygonRegularBuilder #(#center #pointA #value)
DrGScriptPlayer #(#wizard #input #scriptClass)
DrGScriptPlayerHeadless #()
DrGSegmentBuilder #(#pointA #pointB)
DrGCircleBuilder #(#radius #segment)
DrGLineBuilder #()
DrGAngleBisectorBuilder #(#pointC #angle)
DrGParallelBuilder #(#direction)
DrGPerpendicularBuilder #()
DrGPerpendicularBisectorBuilder #(#segment)
DrGRayBuilder #()
DrGVectorBuilder #()
DrGTextBuilder #()
DrGTransformationBuilder #(#mathItem)
DrGReflectionBuilder #(#axe)
DrGRotationBuilder #(#center #value)
DrGHomothetyBuilder #()
DrGSymmetryBuilder #(#center)
DrGTranslationBuilder #(#vector)
DrGValueBuilder #(#curveItem #pointA #pointB)
DrGWrappedItem
Object #()
DrGWrappedItem #(#costume)
DrGWrappedCurve #()
DrGWrappedFilledCurve #()
DrGWrappedFinitCurve #()
DrGWrappedSegment #()
DrGWrappedPoint #()
DrGWrappedText #()
DrGWrappedValue #()
A geometric item such as a point has a costume object of a particular costume class.
The costumes are the views of the geometric items, see class comment of the DrGeo object.
An example:
| c ptA|
c := DrGeoCanvas new.
ptA := c point: 0@0.
ptA costume computeTextPositionDelta: 25@ -25.
Use the #constraintTextPosition: message to provide coordinates position, but it is tricky to use at it requires pixel position.