Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
digilib-pivaj
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel ANTELME
digilib-pivaj
Commits
ee9e020c
Commit
ee9e020c
authored
10 years ago
by
hertzhaft
Browse files
Options
Downloads
Patches
Plain Diff
added Grid shape
parent
0fd9e525
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+39
-5
39 additions, 5 deletions
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+1
-0
1 addition, 0 deletions
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
with
40 additions
and
5 deletions
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+
39
−
5
View file @
ee9e020c
...
@@ -707,10 +707,8 @@
...
@@ -707,10 +707,8 @@
lineColor
:
'
red
'
,
lineColor
:
'
red
'
,
// color while the line is drawn
// color while the line is drawn
drawColor
:
'
green
'
,
drawColor
:
'
green
'
,
// color of selected objects
selectColor
:
'
red
'
,
// implemented measuring shape types, for select widget
// 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
// all measuring shape types
shapeInfo
:
{
shapeInfo
:
{
Line
:
{
name
:
'
line
'
,
display
:
'
length
'
,
},
Line
:
{
name
:
'
line
'
,
display
:
'
length
'
,
},
...
@@ -863,6 +861,18 @@
...
@@ -863,6 +861,18 @@
return
Math
.
round
(
num
*
10000
+
0.00001
)
/
10000
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)
// calculate the distance of the first 2 points of a shape (rectified digilib coords)
var
rectifiedDist
=
function
(
data
,
shape
)
{
var
rectifiedDist
=
function
(
data
,
shape
)
{
var
coords
=
shape
.
geometry
.
coordinates
;
var
coords
=
shape
.
geometry
.
coordinates
;
...
@@ -976,6 +986,7 @@
...
@@ -976,6 +986,7 @@
'
editable
'
:
true
,
'
editable
'
:
true
,
'
selected
'
:
false
,
'
selected
'
:
false
,
'
stroke
'
:
getSelectedStroke
(
data
),
'
stroke
'
:
getSelectedStroke
(
data
),
'
stroke-width
'
:
1
,
'
cssclass
'
:
shapeClass
(
shapeType
)
'
cssclass
'
:
shapeClass
(
shapeType
)
// 'center' : data.settings.drawFromCenter
// 'center' : data.settings.drawFromCenter
}
}
...
@@ -1033,7 +1044,7 @@
...
@@ -1033,7 +1044,7 @@
// return line color from settings (TODO: chosen by user)
// return line color from settings (TODO: chosen by user)
var
getSelectedStroke
=
function
(
data
)
{
var
getSelectedStroke
=
function
(
data
)
{
// TODO: colorpicker
// TODO: colorpicker
return
data
.
settings
.
line
c
olor
;
return
data
.
settings
.
line
C
olor
;
};
};
// load shape types into select element
// load shape types into select element
...
@@ -1207,6 +1218,28 @@
...
@@ -1207,6 +1218,28 @@
};
};
return
$s
;
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
// set up a div for accessing the measuring functionality
...
@@ -1280,6 +1313,7 @@
...
@@ -1280,6 +1313,7 @@
data
.
measureFactor
=
1.0
,
data
.
measureFactor
=
1.0
,
setupMeasureBar
(
data
);
setupMeasureBar
(
data
);
setupSvgFactory
(
data
);
setupSvgFactory
(
data
);
data
.
vectorLayers
[
0
].
handleType
=
'
diamond
'
;
};
};
// event handler for scaler update
// event handler for scaler update
...
@@ -1292,7 +1326,7 @@
...
@@ -1292,7 +1326,7 @@
var
install
=
function
(
plugin
)
{
var
install
=
function
(
plugin
)
{
digilib
=
plugin
;
digilib
=
plugin
;
if
(
digilib
.
plugins
.
vector
==
null
)
{
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
;
return
;
}
}
console
.
debug
(
'
installing measure plugin. digilib:
'
,
digilib
);
console
.
debug
(
'
installing measure plugin. digilib:
'
,
digilib
);
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+
1
−
0
View file @
ee9e020c
...
@@ -207,6 +207,7 @@
...
@@ -207,6 +207,7 @@
$
.
extend
(
digilib
.
actions
,
actions
);
$
.
extend
(
digilib
.
actions
,
actions
);
// export functions
// export functions
digilib
.
fn
.
vectorDefaultRenderFn
=
renderShapes
;
digilib
.
fn
.
vectorDefaultRenderFn
=
renderShapes
;
digilib
.
fn
.
svgElement
=
svgElement
;
};
};
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment