-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from SpeciesFileGroup/development
Refactor clusters, add FO to map
- Loading branch information
Showing
11 changed files
with
102 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export const TYPE_MATERIAL = 'TypeMaterial' | ||
export const COLLECTION_OBJECT = 'CollectionObject' | ||
export const AGGREGATE = 'Aggregate' | ||
export const ASSERTED_DISTRIBUTION = 'AssertedDistribution' | ||
export const COLLECTION_OBJECT = 'CollectionObject' | ||
export const FIELD_OCCURRENCE = 'FieldOccurrence' | ||
export const GEOREFERENCE = 'Georeference' | ||
export const AGGREGATE = 'Aggregate' | ||
export const OTU = 'Otu' | ||
export const TYPE_MATERIAL = 'TypeMaterial' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/modules/otus/components/Panel/PanelMap/clusters/CollectionObject.js
This file was deleted.
Oops, something went wrong.
52 changes: 42 additions & 10 deletions
52
src/modules/otus/components/Panel/PanelMap/clusters/Mixed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/modules/otus/components/Panel/PanelMap/clusters/TypeMaterial.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from './CollectionObject' | ||
export * from './Mixed' | ||
export * from './TypeMaterial' | ||
export * from './makeClusterIconFor' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './isRankGroup' | ||
export * from './makeGeoJSONFeature' | ||
export * from './makeSegmentedCircle' | ||
export * from './removeDuplicateShapes' |
40 changes: 40 additions & 0 deletions
40
src/modules/otus/components/Panel/PanelMap/utils/makeSegmentedCircle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export function makeSegmentedCircle({ segments, attributes = {} }) { | ||
const svgNS = 'http://www.w3.org/2000/svg' | ||
const svg = document.createElementNS(svgNS, 'svg') | ||
|
||
svg.setAttribute('viewBox', `-1 -1 2 2`) | ||
svg.setAttribute('style', 'transform: rotate(-90deg)') | ||
|
||
console.log(segments) | ||
console.log(attributes) | ||
|
||
for (let key in attributes) { | ||
svg.setAttribute(key, attributes[key]) | ||
} | ||
|
||
const angleStep = (2 * Math.PI) / segments.length | ||
|
||
segments.forEach((slice, i) => { | ||
const startAngle = i * angleStep | ||
const endAngle = (i + 1) * angleStep | ||
|
||
const x1 = Math.cos(startAngle) | ||
const y1 = Math.sin(startAngle) | ||
const x2 = Math.cos(endAngle) | ||
const y2 = Math.sin(endAngle) | ||
|
||
const largeArc = angleStep > Math.PI ? 1 : 0 | ||
|
||
const path = document.createElementNS(svgNS, 'path') | ||
path.setAttribute( | ||
'd', | ||
`M 0 0 L ${x1} ${y1} A 1 1 0 ${largeArc} 1 ${x2} ${y2} Z` | ||
) | ||
|
||
path.setAttribute('class', slice.class) | ||
|
||
svg.appendChild(path) | ||
}) | ||
|
||
return svg.outerHTML | ||
} |