Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. this.addGroup('testPackages', {
  2. normalStyle: new ol.style.Style({
  3. stroke: new ol.style.Stroke({ color: '#c407d3', width: 3, lineDash: [.1, 5] }),
  4. fill: new ol.style.Fill({ color: 'rgba(196, 7, 211, 0.1)' })
  5. }),
  6. hoverStyle: new ol.style.Style({
  7. stroke: new ol.style.Stroke({ color: '#c407d3', width: 3, lineDash: [.1, 5] }),
  8. fill: new ol.style.Fill({ color: 'rgba(196, 7, 211, 0.4)' })
  9. }),
  10. selectedStyle: new ol.style.Style({
  11. stroke: new ol.style.Stroke({ color: '#c407d3', width: 3 }),
  12. fill: new ol.style.Fill({ color: 'rgba(196, 7, 211, 0.4)' })
  13. })
  14.  
  15. });
  16.  
  17. this.addGroup('cabinets', {
  18. normalStyle: new ol.style.Style({
  19. image: new ol.style.Icon(({
  20. scale: 0.25,
  21. anchor: [0.5, 1],
  22. anchorXUnits: 'fraction',
  23. anchorYUnits: 'fraction',
  24. opacity: 1,
  25. src: '/images/olMaps/house.png'
  26. }))
  27. }),
  28. hoverStyle: new ol.style.Style({
  29. image: new ol.style.Icon(({
  30. scale: 0.25,
  31. anchor: [0.5, 1],
  32. anchorXUnits: 'fraction',
  33. anchorYUnits: 'fraction',
  34. opacity: 1,
  35. src: '/images/olMaps/house.png'
  36. }))
  37. }),
  38. selectedStyle: new ol.style.Style({
  39. image: new ol.style.Icon(({
  40. scale: 0.25,
  41. anchor: [0.5, 1],
  42. anchorXUnits: 'fraction',
  43. anchorYUnits: 'fraction',
  44. opacity: 1,
  45. src: '/images/olMaps/house.png'
  46. }))
  47. })
  48.  
  49. })
  50.  
  51. drawLine(geoShape: any, assetId: string, group: IAssetGroup) { // vectorLine: ol.source.Vector, style?: ol.style.Style) {
  52.  
  53. // Transform the geometry for a map line-string.
  54. const transformedGeometry = this.transformCoordinates(geoShape);
  55. const lineString = new ol.geom.LineString(<any>transformedGeometry);
  56.  
  57. // Create the line-string feature.
  58. const feature = new ol.Feature({
  59. geometry: lineString,
  60. id: assetId,
  61. group: group
  62. });
  63.  
  64. // Set the style on the feature?
  65. if (!!group.normalStyle)
  66. feature.setStyle(group.normalStyle);
  67.  
  68. // Add the feature to the vector-set.
  69. group.vector.addFeature(feature);
  70.  
  71. // Add to list of all features.
  72. this.allFeatures.push(feature);
  73. this.lookupFeatures[assetId] = feature;
  74.  
  75. }
  76.  
  77. drawMarker(geoLocation: [number, number], assetId: string, type: string, group: IAssetGroup) {
  78.  
  79. // Transform the geometry for a map point.
  80. const coordinates = this.transformCoordinates(geoLocation);
  81. const pointGeometry = new ol.geom.Point(<any>coordinates);
  82.  
  83. // Create the point feature.
  84. const feature = new ol.Feature({
  85. geometry: pointGeometry,
  86. id: assetId,
  87. group: group
  88. });
  89.  
  90. // Set the style on the feature?
  91. if (!!group.normalStyle)
  92. feature.setStyle(group.normalStyle);
  93.  
  94. // Add the feature to the vector-set.
  95. group.vector.addFeature(feature);
  96.  
  97. // Add to list of all features.
  98. this.allFeatures.push(feature);
  99. this.lookupFeatures[assetId] = feature;
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement