Commit 1c10637a authored by hertzhaft's avatar hertzhaft

added Proportion shape (LineString with only 3 vertices)

parent 3b4e2348
...@@ -710,12 +710,14 @@ ...@@ -710,12 +710,14 @@
// color of selected objects // color of selected objects
selectColor : 'red', selectColor : 'red',
// implemented measuring shape types, for select widget // implemented measuring shape types, for select widget
implementedShapes : ['Line', 'LineString', 'Rectangle', 'Polygon', 'Circle', 'Ellipse'], implementedShapes : ['Line', 'LineString', 'Proportion', 'Rectangle', 'Polygon', 'Circle', 'Ellipse'],
// all measuring shape types // all measuring shape types
shapeInfo : { shapeInfo : {
Line : { name : 'line', display : 'length', }, Line : { name : 'line', display : 'length', },
LineString : { name : 'linestring', display : 'length' }, LineString : { name : 'linestring', display : 'length' },
Rectangle : { name : 'rectangle', display : 'area' }, Proportion : { name : 'proportion', display : 'length' },
Rectangle : { name : 'box', display : 'area' },
Rect : { name : 'rectangle', display : 'area' },
Square : { name : 'square', display : 'length' }, Square : { name : 'square', display : 'length' },
Polygon : { name : 'polygon', display : 'area' }, Polygon : { name : 'polygon', display : 'area' },
Circle : { name : 'circle', display : 'radius' }, Circle : { name : 'circle', display : 'radius' },
...@@ -1170,6 +1172,20 @@ ...@@ -1170,6 +1172,20 @@
keystate = {}; keystate = {};
}; };
// set up additional SVG shapes
var setupSvgFactory = function(data) {
var factory = data.svgFactory;
if (factory == null) {
console.error("No SVG factory found: jquery.digilib.vector not loaded?");
return;
}
factory['Proportion'] = function (shape) {
var $s = factory['LineString'](shape);
shape.properties.maxvtx = 3;
return $s;
}
};
// set up a div for accessing the measuring functionality // set up a div for accessing the measuring functionality
var setupMeasureBar = function(data) { var setupMeasureBar = function(data) {
console.debug('measure: setupMeasureBar'); console.debug('measure: setupMeasureBar');
...@@ -1240,6 +1256,7 @@ ...@@ -1240,6 +1256,7 @@
data.lastMeasuredAngle = 0; data.lastMeasuredAngle = 0;
data.measureFactor = 1.0, data.measureFactor = 1.0,
setupMeasureBar(data); setupMeasureBar(data);
setupSvgFactory(data);
}; };
// event handler for scaler update // event handler for scaler update
......
...@@ -518,7 +518,7 @@ ...@@ -518,7 +518,7 @@
return; return;
} }
var shapeType = shape.geometry.type; var shapeType = shape.geometry.type;
if (!isSupported(shapeType)) { if (!isSupported(data, shapeType)) {
console.error("renderShape: unsupported shape type: "+shapeType); console.error("renderShape: unsupported shape type: "+shapeType);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment