Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C125 annotations #2757

Merged
merged 8 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions web/client/components/map/openlayers/VectorStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const image = new ol.style.Circle({
});

const Icons = require('../../../utils/openlayers/Icons');
const {hexToRgb} = require('../../../utils/ColorUtils');
const {colorToRgbaStr} = require('../../../utils/ColorUtils');

const STYLE_POINT = {
color: '#ffcc33',
Expand Down Expand Up @@ -175,14 +175,14 @@ const getValidStyle = (geomType, options = { style: defaultStyles}, isDrawing, t
if (geomType === "MultiLineString" || geomType === "LineString") {
style = tempStyle ? {
stroke: new ol.style.Stroke( tempStyle && tempStyle.stroke ? tempStyle.stroke : {
color: hexToRgb(options.style && tempStyle.color || "#0000FF").concat([tempStyle.opacity || 1]),
color: colorToRgbaStr(options.style && tempStyle.color || "#0000FF", tempStyle.opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: tempStyle.weight || 1
}),
image: isDrawing ? image : null
} : {
stroke: new ol.style.Stroke(defaultStyles[geomType] && defaultStyles[geomType].stroke ? defaultStyles[geomType].stroke : {
color: hexToRgb(options.style && defaultStyles[geomType].color || "#0000FF").concat([defaultStyles[geomType].opacity || 1]),
color: colorToRgbaStr(options.style && defaultStyles[geomType].color || "#0000FF", defaultStyles[geomType].opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: defaultStyles[geomType].weight || 1
}) };
Expand All @@ -198,20 +198,20 @@ const getValidStyle = (geomType, options = { style: defaultStyles}, isDrawing, t
if ((geomType === "Circle") && tempStyle.radius ) {
return new ol.style.Style({
stroke: new ol.style.Stroke( tempStyle && tempStyle.stroke ? tempStyle.stroke : {
color: hexToRgb(options.style && tempStyle.color || "#0000FF").concat([tempStyle.opacity || 1]),
color: colorToRgbaStr(options.style && tempStyle.color || "#0000FF", tempStyle.opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: tempStyle.weight || 1
}),
fill: new ol.style.Fill(tempStyle.fill ? tempStyle.fill : {
color: hexToRgb(options.style && tempStyle.fillColor || "#0000FF").concat([tempStyle.fillOpacity || 0.2])
color: colorToRgbaStr(options.style && tempStyle.fillColor || "#0000FF", tempStyle.fillOpacity || 0.2)
}),
image: new ol.style.Circle({
radius: tempStyle.radius || 10,
fill: new ol.style.Fill(tempStyle.fill ? tempStyle.fill : {
color: hexToRgb(options.style && tempStyle.fillColor || "#0000FF").concat([tempStyle.fillOpacity || 0.2])
color: colorToRgbaStr(options.style && tempStyle.fillColor || "#0000FF", tempStyle.fillOpacity || 0.2)
}),
stroke: new ol.style.Stroke({
color: hexToRgb(options.style && tempStyle.color || "#0000FF").concat([tempStyle.opacity || 1]),
color: colorToRgbaStr(options.style && tempStyle.color || "#0000FF", tempStyle.opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: tempStyle.weight || 1
})
Expand All @@ -227,7 +227,7 @@ const getValidStyle = (geomType, options = { style: defaultStyles}, isDrawing, t
text: textValues[0] || "",
font: tempStyle.font,
fill: new ol.style.Fill({
color: hexToRgb(tempStyle.stroke || tempStyle.color || '#000000').concat([tempStyle.opacity || 1])
color: colorToRgbaStr(tempStyle.stroke || tempStyle.color || '#000000', tempStyle.opacity || 1)
})
})
});
Expand All @@ -236,13 +236,13 @@ const getValidStyle = (geomType, options = { style: defaultStyles}, isDrawing, t
if (geomType === "MultiPolygon" || geomType === "Polygon") {
style = {
stroke: new ol.style.Stroke( tempStyle.stroke ? tempStyle.stroke : {
color: hexToRgb(options.style && tempStyle.color || "#0000FF").concat([tempStyle.opacity || 1]),
color: colorToRgbaStr(options.style && tempStyle.color || "#0000FF", tempStyle.opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: tempStyle.weight || 1
}),
image: isDrawing ? image : null,
fill: new ol.style.Fill(tempStyle.fill ? tempStyle.fill : {
color: hexToRgb(options.style && tempStyle.fillColor || "#0000FF").concat([tempStyle.fillOpacity || 1])
color: colorToRgbaStr(options.style && tempStyle.fillColor || "#0000FF", tempStyle.fillOpacity || 1)
})
};
return new ol.style.Style(style);
Expand All @@ -257,12 +257,12 @@ function getStyle(options, isDrawing = false, textValues = []) {
if (!style && options.style) {
style = {
stroke: new ol.style.Stroke( options.style.stroke ? options.style.stroke : {
color: hexToRgb(options.style && options.style.color || "#0000FF").concat([options.style.opacity || 1]),
color: colorToRgbaStr(options.style && options.style.color || "#0000FF", options.style.opacity || 1),
lineDash: options.style.highlight ? [10] : [0],
width: options.style.weight || 1
}),
fill: new ol.style.Fill(options.style.fill ? options.style.fill : {
color: hexToRgb(options.style && options.style.fillColor || "#0000FF").concat([options.style.fillOpacity || 1])
color: colorToRgbaStr(options.style && options.style.fillColor || "#0000FF", options.style.fillOpacity || 1)
})
};

Expand Down
2 changes: 1 addition & 1 deletion web/client/components/style/ColorPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ColorPicker extends React.Component {
<div className={this.props.disabled ? "cp-disabled" : "cp-swatch" } style={this.getStyle()} onClick={ () => { if (!this.props.disabled) { this.setState({ displayColorPicker: !this.state.displayColorPicker }); } } }>
{this.props.text}
</div>
{ this.state.displayColorPicker ? <div className="cp-popover" style={{width: this.props.style.width}}>
{ this.state.displayColorPicker ? <div className="cp-popover" style={{width: this.props.style && this.props.style.width}}>
<div className="cp-cover" onClick={ () => { this.setState({ displayColorPicker: false, color: undefined}); this.props.onChangeColor(this.state.color); }}/>
<SketchPicker color={ this.state.color || this.props.value} onChange={ (color) => { this.setState({ color: color.rgb }); }} />
</div> : null }
Expand Down
Loading