<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: When I developed the map sketch process, sketchEditor  did not appear in the viewport of the map in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1194397#M2607</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It looks like your code is missing some elements. For example, I don't see where you load the FXML that defines your UI so the buttons won't appear. I would suggest trying to structure it more like the&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-java/tree/main/display_information/sketch-on-map" target="_self"&gt;sample code.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With your current code if you call&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;sketchEditor.start()&lt;/LI-CODE&gt;&lt;P&gt;after you have set the sketch editor on the view you can probably begin sketching but the buttons etc. won't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Colin&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2022 12:59:36 GMT</pubDate>
    <dc:creator>ColinAnderson1</dc:creator>
    <dc:date>2022-07-21T12:59:36Z</dc:date>
    <item>
      <title>When I developed the map sketch process, sketchEditor  did not appear in the viewport of the map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1193764#M2603</link>
      <description>&lt;P&gt;When I developed the map sketch process, sketchEditor did not appear in the viewport of the map，Here is my code, please help me, thanks&lt;/P&gt;&lt;P&gt;package com.mycompany.app;&lt;/P&gt;&lt;P&gt;//Copyright 2020 Esri&lt;BR /&gt;//Licensed under the Apache License, Version 2.0 (the "License");&lt;BR /&gt;//you may not use this file except in compliance with the License.&lt;BR /&gt;//You may obtain a copy of the License at&lt;BR /&gt;//&lt;BR /&gt;//&lt;A href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank" rel="noopener"&gt;http://www.apache.org/licenses/LICENSE-2.0&lt;/A&gt;&lt;BR /&gt;//&lt;BR /&gt;//Unless required by applicable law or agreed to in writing, software&lt;BR /&gt;//distributed under the License is distributed on an "AS IS" BASIS,&lt;BR /&gt;//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;BR /&gt;//See the License for the specific language governing permissions and&lt;BR /&gt;//limitations under the License.&lt;/P&gt;&lt;P&gt;import javafx.fxml.FXML;&lt;BR /&gt;import javafx.geometry.Point2D;&lt;BR /&gt;import javafx.scene.control.Button;&lt;/P&gt;&lt;P&gt;import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.ArcGISMap;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.BasemapStyle;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.Viewpoint;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.view.Graphic;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.view.MapView;&lt;BR /&gt;import com.esri.arcgisruntime.mapping.view.SketchEditor;&lt;BR /&gt;import com.esri.arcgisruntime.symbology.SimpleFillSymbol;&lt;BR /&gt;import com.esri.arcgisruntime.symbology.SimpleLineSymbol;&lt;BR /&gt;import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;&lt;/P&gt;&lt;P&gt;import javafx.application.Application;&lt;BR /&gt;import javafx.fxml.FXML;&lt;BR /&gt;import javafx.scene.Scene;&lt;BR /&gt;import javafx.scene.control.Button;&lt;BR /&gt;import javafx.scene.layout.StackPane;&lt;BR /&gt;import javafx.stage.Stage;&lt;/P&gt;&lt;P&gt;public class SketchOnMapController2 extends Application {&lt;/P&gt;&lt;P&gt;@FXML&lt;BR /&gt;private Button redoButton;&lt;BR /&gt;@FXML&lt;BR /&gt;private Button undoButton;&lt;BR /&gt;@FXML&lt;BR /&gt;private Button clearButton;&lt;BR /&gt;@FXML&lt;BR /&gt;private Button saveButton;&lt;BR /&gt;@FXML&lt;BR /&gt;private Button editButton;&lt;BR /&gt;@FXML&lt;BR /&gt;private Button stopButton;&lt;/P&gt;&lt;P&gt;private SketchEditor sketchEditor;&lt;BR /&gt;private GraphicsOverlay graphicsOverlay;&lt;BR /&gt;private Graphic graphic;&lt;BR /&gt;private SimpleFillSymbol fillSymbol;&lt;BR /&gt;private SimpleLineSymbol lineSymbol;&lt;BR /&gt;private SimpleMarkerSymbol pointSymbol;&lt;BR /&gt;private MapView mapView;&lt;/P&gt;&lt;P&gt;public static void main(String[] args) {&lt;BR /&gt;Application.launch(args);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;@Override&lt;BR /&gt;public void start(Stage stage) {&lt;BR /&gt;// set the title and size of the stage and show it&lt;BR /&gt;stage.setTitle("Display a map tutorial");&lt;BR /&gt;stage.setWidth(800);&lt;BR /&gt;stage.setHeight(700);&lt;BR /&gt;stage.show();&lt;/P&gt;&lt;P&gt;// create a JavaFX scene with a stack pane as the root node, and add it to the scene&lt;BR /&gt;StackPane stackPane = new StackPane();&lt;BR /&gt;Scene scene = new Scene(stackPane);&lt;BR /&gt;stage.setScene(scene);&lt;/P&gt;&lt;P&gt;// Note: it is not best practice to store API keys in source code.&lt;BR /&gt;// The API key is referenced here for the convenience of this tutorial.&lt;BR /&gt;String yourApiKey = "AAPKe82436f57ac0479e84c38cd64354c2b7OJpYBvfcCaLME8*******************";&lt;BR /&gt;ArcGISRuntimeEnvironment.setApiKey(yourApiKey);&lt;/P&gt;&lt;P&gt;// create a map view to display the map and add it to the stack pane&lt;BR /&gt;mapView = new MapView();&lt;BR /&gt;stackPane.getChildren().add(mapView);&lt;/P&gt;&lt;P&gt;ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_IMAGERY_STANDARD);&lt;/P&gt;&lt;P&gt;// set the map on the map view&lt;BR /&gt;mapView.setMap(map);&lt;/P&gt;&lt;P&gt;mapView.setViewpoint(new Viewpoint(34.02700, -118.80543, 144447.638572));&lt;/P&gt;&lt;P&gt;//set a viewpoint on the map view&lt;BR /&gt;mapView.setViewpoint(new Viewpoint(64.3286, -15.5314, 72223));&lt;/P&gt;&lt;P&gt;// create a graphics overlay for the graphics&lt;BR /&gt;graphicsOverlay = new GraphicsOverlay();&lt;/P&gt;&lt;P&gt;// add the graphics overlay to the map view&lt;BR /&gt;mapView.getGraphicsOverlays().add(graphicsOverlay);&lt;/P&gt;&lt;P&gt;// create a new sketch editor and add it to the map view&lt;BR /&gt;sketchEditor = new SketchEditor();&lt;BR /&gt;mapView.setSketchEditor(sketchEditor);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// red square for points&lt;BR /&gt;pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.SQUARE, 0xFFFF0000, 20);&lt;BR /&gt;// thin green line for polylines&lt;BR /&gt;lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF64c113, 4);&lt;BR /&gt;// blue outline for polygons&lt;BR /&gt;SimpleLineSymbol polygonLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF1396c1, 4);&lt;BR /&gt;// cross-hatched interior for polygons&lt;BR /&gt;fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, 0x40FFA9A9, polygonLineSymbol);&lt;/P&gt;&lt;P&gt;// add a listener for when sketch geometry is changed&lt;BR /&gt;sketchEditor.addGeometryChangedListener(SketchGeometryChangedListener -&amp;gt; {&lt;BR /&gt;stopButton.setDisable(false);&lt;BR /&gt;// save button enable depends on if the sketch is valid. If the sketch is valid then set disable opposite of true&lt;BR /&gt;saveButton.setDisable(!sketchEditor.isSketchValid());&lt;BR /&gt;undoButton.setDisable(!sketchEditor.canUndo());&lt;BR /&gt;redoButton.setDisable(!sketchEditor.canUndo());&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Stops and releases all resources used in application.&lt;BR /&gt;*/&lt;BR /&gt;@Override&lt;BR /&gt;public void stop() {&lt;BR /&gt;if (mapView != null) {&lt;BR /&gt;mapView.dispose();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 05:01:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1193764#M2603</guid>
      <dc:creator>yw19841107</dc:creator>
      <dc:date>2022-07-20T05:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: When I developed the map sketch process, sketchEditor  did not appear in the viewport of the map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1194397#M2607</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It looks like your code is missing some elements. For example, I don't see where you load the FXML that defines your UI so the buttons won't appear. I would suggest trying to structure it more like the&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-java/tree/main/display_information/sketch-on-map" target="_self"&gt;sample code.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With your current code if you call&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;sketchEditor.start()&lt;/LI-CODE&gt;&lt;P&gt;after you have set the sketch editor on the view you can probably begin sketching but the buttons etc. won't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Colin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 12:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1194397#M2607</guid>
      <dc:creator>ColinAnderson1</dc:creator>
      <dc:date>2022-07-21T12:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: When I developed the map sketch process, sketchEditor  did not appear in the viewport of the map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1194793#M2610</link>
      <description>&lt;P&gt;Thank you for your answer. I have successfully solved this problem. Refer to JavaFX tutorial&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 06:24:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/when-i-developed-the-map-sketch-process/m-p/1194793#M2610</guid>
      <dc:creator>yw19841107</dc:creator>
      <dc:date>2022-07-22T06:24:38Z</dc:date>
    </item>
  </channel>
</rss>

