|
@@ -26,6 +26,9 @@ import AddSingleLayer from "../units/map/AddSingleLayer.js";
|
|
|
import WaterEffect from "../units/map/WaterEffect.js";
|
|
|
import Measurement from "../units/map/Measurement.js";
|
|
|
import SunshineAnalysis from "../units/map/SunshineAnalysis.js";
|
|
|
+import AddPointEvent from "../units/map/AddPointEvent.js";
|
|
|
+import SetPopupOptions from "../units/map/SetPopuopOptions";
|
|
|
+import AddScaleEvent from "../units/map/AddScaleEvent";
|
|
|
export default {
|
|
|
name: "mapJK",
|
|
|
setup(){
|
|
@@ -39,6 +42,7 @@ export default {
|
|
|
let m_map;
|
|
|
let measureWidget = null;
|
|
|
let sunshineWidget = null;
|
|
|
+ let m_handles = [];
|
|
|
onMounted(() =>{
|
|
|
bus.on('CreateMap',() =>{
|
|
|
MapReady = $.Deferred();
|
|
@@ -61,11 +65,13 @@ export default {
|
|
|
let setMapConfig = new SetMapConfig({
|
|
|
m_spatialReference,
|
|
|
m_fullExtent,
|
|
|
- m_initialExtent
|
|
|
+ m_initialExtent,
|
|
|
+ m_handles
|
|
|
})
|
|
|
m_spatialReference = setMapConfig.m_spatialReference;
|
|
|
m_fullExtent = setMapConfig.m_fullExtent;
|
|
|
m_initialExtent = setMapConfig.m_initialExtent;
|
|
|
+ m_handles = setMapConfig.m_handles;
|
|
|
let initMap = new InitMap({
|
|
|
m_map,
|
|
|
m_view,
|
|
@@ -102,6 +108,12 @@ export default {
|
|
|
case "SunshineAnalysis":
|
|
|
sunshineAnalysis(params);
|
|
|
break
|
|
|
+ case "AccessFeaturesWithPointEvents":
|
|
|
+ accessFeaturesWithPointEvents(params);
|
|
|
+ break;
|
|
|
+ case "ShowLayersWithScaleEvents":
|
|
|
+ showLayersWithScaleEvents(params);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
function setBackground(params){
|
|
@@ -205,6 +217,83 @@ export default {
|
|
|
m_view.ui.add(sunshineWidget,position);
|
|
|
}
|
|
|
}
|
|
|
+ function accessFeaturesWithPointEvents(params){
|
|
|
+ let status = params.status;
|
|
|
+ let mouse_handle_id = params.mouse_handle_id;
|
|
|
+ let highlight_handle_id = params.highlight_handle_id;
|
|
|
+ if(status === "hide"){
|
|
|
+ if(m_handles.has(mouse_handle_id)){
|
|
|
+ m_handles.remove(mouse_handle_id);
|
|
|
+ }
|
|
|
+ if(m_handles.has(highlight_handle_id)){
|
|
|
+ m_handles.remove(highlight_handle_id);
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(status === "show"){
|
|
|
+ let type = params.type;
|
|
|
+ let mouseTime = params.mouse_time;
|
|
|
+ let popupTitle = params.popup_title;
|
|
|
+ if(m_handles.has(mouse_handle_id)){
|
|
|
+ m_handles.remove(mouse_handle_id);
|
|
|
+ }
|
|
|
+ if(m_handles.has(highlight_handle_id)){
|
|
|
+ m_handles.remove(highlight_handle_id);
|
|
|
+ }
|
|
|
+ let addPointEvent = new AddPointEvent({
|
|
|
+ m_view,
|
|
|
+ type,
|
|
|
+ highlightHandleId:highlight_handle_id,
|
|
|
+ mouseTime,
|
|
|
+ popupTitle,
|
|
|
+ callbackFunction:accessFeaturesWithPointEventsReturn
|
|
|
+ });
|
|
|
+ m_handles.add(addPointEvent.mouseHandle,mouse_handle_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function accessFeaturesWithPointEventsReturn(screenPoint,handleId,popupTitle){
|
|
|
+ if(m_handles.has(handleId)){
|
|
|
+ m_handles.remove(handleId);
|
|
|
+ }
|
|
|
+ m_view.hitTest(screenPoint).then((response) =>{
|
|
|
+ if(response.results.length > 0){
|
|
|
+ let result = response.results[0];
|
|
|
+ m_view.whenLayerView(result.graphic.layer).then((lyrView) =>{
|
|
|
+ let highlightHandle = lyrView.highlight(result.graphic);
|
|
|
+ m_handles.add(highlightHandle,handleId);
|
|
|
+ })
|
|
|
+ let setPopupOptions = new SetPopupOptions({
|
|
|
+ title:popupTitle,
|
|
|
+ location:m_view.toMap(screenPoint),
|
|
|
+ content:result.graphic.attributes
|
|
|
+ })
|
|
|
+ m_view.popup.open(setPopupOptions.popupOptions());
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function showLayersWithScaleEvents(params){
|
|
|
+ let status = params.status;
|
|
|
+ let scale_handle_id = params.scale_handle_id;
|
|
|
+ if(status === "hide"){
|
|
|
+ if(m_handles.has(scale_handle_id)){
|
|
|
+ m_handles.remove(scale_handle_id);
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(status === "show"){
|
|
|
+ if(m_handles.has(scale_handle_id)){
|
|
|
+ m_handles.remove(scale_handle_id);
|
|
|
+ }
|
|
|
+ let addScaleEvent = new AddScaleEvent({
|
|
|
+ m_view,
|
|
|
+ callBackFunction:showLayersWithScaleEventsReturn
|
|
|
+ });
|
|
|
+ m_handles.add(addScaleEvent.scaleHandle,scale_handle_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function showLayersWithScaleEventsReturn(scaleValue){
|
|
|
+
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|