Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
f3d1aebe
Kaydet (Commit)
f3d1aebe
authored
Mar 09, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reformatted slightly openlayers.js
üst
6a91b638
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
19 deletions
+25
-19
openlayers.js
django/contrib/gis/templates/gis/admin/openlayers.js
+25
-19
No files found.
django/contrib/gis/templates/gis/admin/openlayers.js
Dosyayı görüntüle @
f3d1aebe
...
...
@@ -10,19 +10,21 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
{{
module
}}.
is_polygon
=
{{
is_polygon
|
yesno
:
"true,false"
}};
{{
module
}}.
is_point
=
{{
is_point
|
yesno
:
"true,false"
}};
{
%
endblock
%
}
{{
module
}}.
get_ewkt
=
function
(
feat
){
return
'SRID={{ srid }};'
+
{{
module
}}.
wkt_f
.
write
(
feat
);}
{{
module
}}.
get_ewkt
=
function
(
feat
){
return
'SRID={{ srid }};'
+
{{
module
}}.
wkt_f
.
write
(
feat
);
};
{{
module
}}.
read_wkt
=
function
(
wkt
){
// OpenLayers cannot handle EWKT -- we make sure to strip it out.
// EWKT is only exposed to OL if there's a validation error in the admin.
var
match
=
{{
module
}}.
re
.
exec
(
wkt
);
if
(
match
){
wkt
=
match
[
1
];}
return
{{
module
}}.
wkt_f
.
read
(
wkt
);
}
}
;
{{
module
}}.
write_wkt
=
function
(
feat
){
if
({{
module
}}.
is_collection
){
{{
module
}}.
num_geom
=
feat
.
geometry
.
components
.
length
;}
else
{
{{
module
}}.
num_geom
=
1
;}
document
.
getElementById
(
'{{ id }}'
).
value
=
{{
module
}}.
get_ewkt
(
feat
);
}
}
;
{{
module
}}.
add_wkt
=
function
(
event
){
// This function will sync the contents of the `vector` layer with the
// WKT in the text field.
...
...
@@ -41,7 +43,7 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
}
{{
module
}}.
write_wkt
(
event
.
feature
);
}
}
}
;
{{
module
}}.
modify_wkt
=
function
(
event
){
if
({{
module
}}.
is_collection
){
if
({{
module
}}.
is_point
){
...
...
@@ -52,34 +54,38 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
// vector layer so we only increment to the `num_geom` value.
var
feat
=
new
OpenLayers
.
Feature
.
Vector
(
new
OpenLayers
.
Geometry
.{{
geom_type
}}());
for
(
var
i
=
0
;
i
<
{{
module
}}.
num_geom
;
i
++
){
feat
.
geometry
.
addComponents
([{{
module
}}.
layers
.
vector
.
features
[
i
].
geometry
]);
feat
.
geometry
.
addComponents
([{{
module
}}.
layers
.
vector
.
features
[
i
].
geometry
]);
}
{{
module
}}.
write_wkt
(
feat
);
}
}
else
{
{{
module
}}.
write_wkt
(
event
.
feature
);
}
}
}
;
// Function to clear vector features and purge wkt from div
{{
module
}}.
deleteFeatures
=
function
(){
{{
module
}}.
layers
.
vector
.
removeFeatures
({{
module
}}.
layers
.
vector
.
features
);
{{
module
}}.
layers
.
vector
.
destroyFeatures
();
}
}
;
{{
module
}}.
clearFeatures
=
function
(){
{{
module
}}.
deleteFeatures
();
document
.
getElementById
(
'{{ id }}'
).
value
=
''
;
{
%
localize
off
%
}
{{
module
}}.
map
.
setCenter
(
new
OpenLayers
.
LonLat
({{
default_lon
}},
{{
default_lat
}}),
{{
default_zoom
}});
{
%
endlocalize
%
}
}
}
;
// Add Select control
{{
module
}}.
addSelectControl
=
function
(){
var
select
=
new
OpenLayers
.
Control
.
SelectFeature
({{
module
}}.
layers
.
vector
,
{
'toggle'
:
true
,
'clickout'
:
true
});
{{
module
}}.
map
.
addControl
(
select
);
select
.
activate
();
}
{{
module
}}.
enableDrawing
=
function
(){
{{
module
}}.
map
.
getControlsByClass
(
'OpenLayers.Control.DrawFeature'
)[
0
].
activate
();}
{{
module
}}.
enableEditing
=
function
(){
{{
module
}}.
map
.
getControlsByClass
(
'OpenLayers.Control.ModifyFeature'
)[
0
].
activate
();}
};
{{
module
}}.
enableDrawing
=
function
(){
{{
module
}}.
map
.
getControlsByClass
(
'OpenLayers.Control.DrawFeature'
)[
0
].
activate
();
};
{{
module
}}.
enableEditing
=
function
(){
{{
module
}}.
map
.
getControlsByClass
(
'OpenLayers.Control.ModifyFeature'
)[
0
].
activate
();
};
// Create an array of controls based on geometry type
{{
module
}}.
getControls
=
function
(
lyr
){
{{
module
}}.
panel
=
new
OpenLayers
.
Control
.
Panel
({
'displayClass'
:
'olControlEditingToolbar'
});
...
...
@@ -102,7 +108,7 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
{{
module
}}.
controls
=
[
nav
];
}
}
}
}
;
{{
module
}}.
init
=
function
(){
{
%
block
map_options
%
}
// The options hash, w/ zoom, resolution, and projection settings.
var
options
=
{
...
...
@@ -127,13 +133,13 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
var
admin_geom
=
{{
module
}}.
read_wkt
(
wkt
);
{{
module
}}.
write_wkt
(
admin_geom
);
if
({{
module
}}.
is_collection
){
// If geometry collection, add each component individually so they may be
// edited individually.
for
(
var
i
=
0
;
i
<
{{
module
}}.
num_geom
;
i
++
){
{{
module
}}.
layers
.
vector
.
addFeatures
([
new
OpenLayers
.
Feature
.
Vector
(
admin_geom
.
geometry
.
components
[
i
].
clone
())]);
}
// If geometry collection, add each component individually so they may be
// edited individually.
for
(
var
i
=
0
;
i
<
{{
module
}}.
num_geom
;
i
++
){
{{
module
}}.
layers
.
vector
.
addFeatures
([
new
OpenLayers
.
Feature
.
Vector
(
admin_geom
.
geometry
.
components
[
i
].
clone
())]);
}
}
else
{
{{
module
}}.
layers
.
vector
.
addFeatures
([
admin_geom
]);
{{
module
}}.
layers
.
vector
.
addFeatures
([
admin_geom
]);
}
// Zooming to the bounds.
{{
module
}}.
map
.
zoomToExtent
(
admin_geom
.
geometry
.
getBounds
());
...
...
@@ -171,4 +177,4 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
}
else
{
{{
module
}}.
enableDrawing
();
}
}
}
;
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