Mercurial > hg > digilib
changeset 1357:c176dca2b62b
added Proportion shape (LineString with only 3 vertices)
author | hertzhaft |
---|---|
date | Sun, 15 Feb 2015 15:50:00 +0100 |
parents | 339e406772f9 |
children | 23ea5ccda21a |
files | webapp/src/main/webapp/jquery/jquery.digilib.measure.js webapp/src/main/webapp/jquery/jquery.digilib.vector.js |
diffstat | 2 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Sun Feb 15 14:35:42 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Sun Feb 15 15:50:00 2015 +0100 @@ -710,12 +710,14 @@ // color of selected objects selectColor : 'red', // 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 shapeInfo : { Line : { name : 'line', 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' }, Polygon : { name : 'polygon', display : 'area' }, Circle : { name : 'circle', display : 'radius' }, @@ -1170,6 +1172,20 @@ 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 var setupMeasureBar = function(data) { console.debug('measure: setupMeasureBar'); @@ -1240,6 +1256,7 @@ data.lastMeasuredAngle = 0; data.measureFactor = 1.0, setupMeasureBar(data); + setupSvgFactory(data); }; // event handler for scaler update
--- a/webapp/src/main/webapp/jquery/jquery.digilib.vector.js Sun Feb 15 14:35:42 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.vector.js Sun Feb 15 15:50:00 2015 +0100 @@ -518,7 +518,7 @@ return; } var shapeType = shape.geometry.type; - if (!isSupported(shapeType)) { + if (!isSupported(data, shapeType)) { console.error("renderShape: unsupported shape type: "+shapeType); return; }