Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
digilib-pivaj
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel ANTELME
digilib-pivaj
Commits
ee9e020c
Commit
ee9e020c
authored
Feb 16, 2015
by
hertzhaft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Grid shape
parent
0fd9e525
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
5 deletions
+40
-5
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+39
-5
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+1
-0
No files found.
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
View file @
ee9e020c
...
...
@@ -707,10 +707,8 @@
lineColor
:
'
red
'
,
// color while the line is drawn
drawColor
:
'
green
'
,
// color of selected objects
selectColor
:
'
red
'
,
// implemented measuring shape types, for select widget
implementedShapes
:
[
'
Line
'
,
'
LineString
'
,
'
Proportion
'
,
'
Rect
'
,
'
Rectangle
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
],
implementedShapes
:
[
'
Line
'
,
'
LineString
'
,
'
Proportion
'
,
'
Rect
'
,
'
Rectangle
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
,
'
Grid
'
],
// all measuring shape types
shapeInfo
:
{
Line
:
{
name
:
'
line
'
,
display
:
'
length
'
,
},
...
...
@@ -863,6 +861,18 @@
return
Math
.
round
(
num
*
10000
+
0.00001
)
/
10000
};
// radians of angle between line and the positive X axis
var
rad
=
function
(
p1
,
p2
)
{
var
dx
=
p2
.
x
-
p1
.
x
;
var
dy
=
p2
.
y
-
p1
.
y
;
return
Math
.
atan2
(
dy
,
dx
);
}
// degree of angle between line and the positive X axis
var
deg
=
function
(
p1
,
p2
)
{
return
rad
(
p1
,
p2
)
/
Math
.
PI
*
180
;
}
// calculate the distance of the first 2 points of a shape (rectified digilib coords)
var
rectifiedDist
=
function
(
data
,
shape
)
{
var
coords
=
shape
.
geometry
.
coordinates
;
...
...
@@ -976,6 +986,7 @@
'
editable
'
:
true
,
'
selected
'
:
false
,
'
stroke
'
:
getSelectedStroke
(
data
),
'
stroke-width
'
:
1
,
'
cssclass
'
:
shapeClass
(
shapeType
)
// 'center' : data.settings.drawFromCenter
}
...
...
@@ -1033,7 +1044,7 @@
// return line color from settings (TODO: chosen by user)
var
getSelectedStroke
=
function
(
data
)
{
// TODO: colorpicker
return
data
.
settings
.
line
c
olor
;
return
data
.
settings
.
line
C
olor
;
};
// load shape types into select element
...
...
@@ -1207,6 +1218,28 @@
};
return
$s
;
};
factory
[
'
Grid
'
]
=
function
(
shape
)
{
var
$s
=
factory
[
'
Line
'
](
shape
);
var
place
=
$s
.
place
;
var
props
=
shape
.
properties
;
props
.
maxvtx
=
2
;
var
$g
=
$
(
fn
.
svgElement
(
'
g
'
));
var
$defs
=
$
(
fn
.
svgElement
(
'
defs
'
));
var
$pat
=
$
(
fn
.
svgElement
(
'
pattern
'
,
{
'
id
'
:
'
grid
'
,
'
height
'
:
'
10%
'
,
'
width
'
:
'
10%
'
,
'
patternUnits
'
:
'
objectBoundingBox
'
}));
var
$path
=
$
(
fn
.
svgElement
(
'
path
'
,
{
'
d
'
:
"
M100,0 L0,0 0,100
"
,
'
fill
'
:
'
none
'
,
'
stroke
'
:
props
.
stroke
,
'
stroke-width
'
:
'
1
'
}));
var
$r
=
$
(
fn
.
svgElement
(
'
rect
'
,
{
stroke
:
props
.
stroke
,
fill
:
'
url(#grid)
'
}));
$g
.
append
(
$defs
.
append
(
$pat
.
append
(
$path
))).
append
(
$r
).
append
(
$s
);
$g
.
place
=
function
()
{
place
.
call
(
$s
);
var
p
=
props
.
screenpos
;
var
d
=
p
[
0
].
distance
(
p
[
1
]);
var
angle
=
mRound
(
deg
(
p
[
0
],
p
[
1
]));
var
rotate
=
'
rotate(
'
+
angle
+
'
'
+
p
[
0
].
x
+
'
'
+
p
[
0
].
y
+
'
)
'
;
$r
.
attr
({
x
:
p
[
0
].
x
,
y
:
p
[
0
].
y
,
height
:
d
,
width
:
d
,
transform
:
rotate
});
$pat
.
attr
({
patternTransform
:
rotate
});
};
return
$g
;
};
};
// set up a div for accessing the measuring functionality
...
...
@@ -1280,6 +1313,7 @@
data
.
measureFactor
=
1.0
,
setupMeasureBar
(
data
);
setupSvgFactory
(
data
);
data
.
vectorLayers
[
0
].
handleType
=
'
diamond
'
;
};
// event handler for scaler update
...
...
@@ -1292,7 +1326,7 @@
var
install
=
function
(
plugin
)
{
digilib
=
plugin
;
if
(
digilib
.
plugins
.
vector
==
null
)
{
console
.
debug
(
'
measure plugin: vector plugin
is missing, aborting installation.
'
);
console
.
error
(
'
measure: jquery.digilib.vector.js
is missing, aborting installation.
'
);
return
;
}
console
.
debug
(
'
installing measure plugin. digilib:
'
,
digilib
);
...
...
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
View file @
ee9e020c
...
...
@@ -207,6 +207,7 @@
$
.
extend
(
digilib
.
actions
,
actions
);
// export functions
digilib
.
fn
.
vectorDefaultRenderFn
=
renderShapes
;
digilib
.
fn
.
svgElement
=
svgElement
;
};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment