Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openlayers
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
openlayers
Merge requests
!11
styling for features, support for popups
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
styling for features, support for popups
issue/openlayers-3500706:3500706-enhancements-for-the
into
7.x-3.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Closed
sano
requested to merge
issue/openlayers-3500706:3500706-enhancements-for-the
into
7.x-3.x
4 months ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#3500706
0
0
Merge request reports
Compare
7.x-3.x
7.x-3.x (base)
and
latest version
latest version
ecaa6767
1 commit,
4 months ago
1 file
+
117
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/Plugin/Style/Cluster/Cluster.php
+
117
−
3
Options
@@ -5,12 +5,126 @@ namespace Drupal\openlayers\Plugin\Style\Cluster;
use
Drupal\openlayers\Types\Style
;
/**
*
FIX - Ins
er
t
s
hort comment here
.
*
Enhanced clust
er s
tyle with SVG icon support and circle fallbacks
.
*
* @OpenlayersPlugin(
* id = "Cluster"
* )
*/
class
Cluster
extends
Style
{
// FIX: Provide options to let user customize the cluster style.
}
/**
* {@inheritdoc}
*/
public
function
optionsForm
(
array
&
$form
,
array
&
$form_state
)
{
// Icon configuration
$form
[
'options'
][
'single_icon'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Camera Icon URL'
),
'#default_value'
=>
$this
->
getOption
(
'single_icon'
,
''
),
'#description'
=>
t
(
'URL for the single camera icon. SVG format recommended. Leave empty to use circle style.'
),
);
$form
[
'options'
][
'single_icon_scale'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Icon Scale'
),
'#default_value'
=>
$this
->
getOption
(
'single_icon_scale'
,
'0.25'
),
'#description'
=>
t
(
'Scale factor for single camera icons (e.g., 0.5 for half size).'
),
);
$form
[
'options'
][
'group_icon'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Icon URL'
),
'#default_value'
=>
$this
->
getOption
(
'group_icon'
,
''
),
'#description'
=>
t
(
'URL for the group camera icon. SVG format recommended. Leave empty to use circle style.'
),
);
$form
[
'options'
][
'group_icon_scale'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Icon Scale'
),
'#default_value'
=>
$this
->
getOption
(
'group_icon_scale'
,
'0.75'
),
'#description'
=>
t
(
'Scale factor for grouped camera icons.'
),
);
$form
[
'options'
][
'single_radius'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Feature Radius'
),
'#default_value'
=>
$this
->
getOption
(
'single_radius'
,
8
),
'#description'
=>
t
(
'Radius of the circle for single features.'
),
// '#fieldset' => 'single_styles',
);
$form
[
'options'
][
'single_fill_color'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Feature Fill Color'
),
'#default_value'
=>
$this
->
getOption
(
'single_fill_color'
,
'#3388ff'
),
'#description'
=>
t
(
'Fill color for single feature circles (hex format).'
),
);
$form
[
'options'
][
'single_stroke_color'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Feature Stroke Color'
),
'#default_value'
=>
$this
->
getOption
(
'single_stroke_color'
,
'#ffffff'
),
'#description'
=>
t
(
'Stroke (outline) color for single feature circles (hex format).'
),
);
$form
[
'options'
][
'single_stroke_width'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Single Feature Stroke Width'
),
'#default_value'
=>
$this
->
getOption
(
'single_stroke_width'
,
2
),
'#description'
=>
t
(
'Stroke (outline) width for single feature circles.'
),
);
$form
[
'options'
][
'group_radius'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Feature Radius'
),
'#default_value'
=>
$this
->
getOption
(
'group_radius'
,
16
),
'#description'
=>
t
(
'Radius of the circle for grouped features.'
),
);
$form
[
'options'
][
'group_fill_color'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Feature Fill Color'
),
'#default_value'
=>
$this
->
getOption
(
'group_fill_color'
,
'#c025bd'
),
'#description'
=>
t
(
'Fill color for group circles (hex format).'
),
);
$form
[
'options'
][
'group_stroke_color'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Feature Stroke Color'
),
'#default_value'
=>
$this
->
getOption
(
'group_stroke_color'
,
'#ffffff'
),
'#description'
=>
t
(
'Stroke (outline) color for group circles (hex format).'
),
);
$form
[
'options'
][
'group_stroke_width'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Group Feature Stroke Width'
),
'#default_value'
=>
$this
->
getOption
(
'group_stroke_width'
,
2
),
'#description'
=>
t
(
'Stroke (outline) width for group circles.'
),
);
return
$form
;
}
/**
* {@inheritdoc}
*/
public
function
optionsFormSubmit
(
array
$form
,
array
&
$form_state
)
{
parent
::
optionsFormSubmit
(
$form
,
$form_state
);
// Ensure numeric values are properly typed
$numeric_fields
=
[
'single_icon_scale'
,
'group_icon_scale'
,
'single_radius'
,
'single_stroke_width'
,
'group_radius'
,
'group_stroke_width'
];
foreach
(
$numeric_fields
as
$field
)
{
if
(
isset
(
$form_state
[
'values'
][
'options'
][
$field
]))
{
$form_state
[
'values'
][
'options'
][
$field
]
=
(
float
)
$form_state
[
'values'
][
'options'
][
$field
];
}
}
}
}
\ No newline at end of file
Loading