Commit dc63c8d5 authored by Gavin's avatar Gavin
Browse files

made console buttons work, draw wkt string button not done yet

parent dedabc66
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ export default function QueryConsole() {
                orientation="vertical"
                size="small"
                variant="contained">
                <Button sx={css.button} startIcon={<ContentCopyIcon />}>Copy Code</Button>
                <Button id="copyCodeButton" sx={css.button} startIcon={<ContentCopyIcon />}>Copy Code</Button>
                <Button id="wktButton" sx={css.button} startIcon={<PolylineIcon />}>Draw WKT String</Button>
                <Button sx={css.button} startIcon={<PlayArrowIcon />}>Run STAC Query</Button>
                <Button id="runQueryButton" sx={css.button} startIcon={<PlayArrowIcon />}>Run STAC Query</Button>
              </ButtonGroup>
            </div>
          </div>
+17 −6
Original line number Diff line number Diff line
@@ -79,13 +79,10 @@ export default L.Control.AstroDrawControl = L.Control.Draw.extend({
      this
    );

    L.DomEvent.on(
      L.DomUtil.get("applyButton"),
      "click",
      this.applyFilter,
      this
    );
    L.DomEvent.on(L.DomUtil.get("applyButton"),"click", this.applyFilter, this);
    L.DomEvent.on(L.DomUtil.get("runQueryButton"),"click", this.applyFilter, this);
    L.DomEvent.on(L.DomUtil.get("clearButton"), "click", this.clearMap, this);
    L.DomEvent.on(L.DomUtil.get("copyCodeButton"), "click", this.copyToClipboard, this);

    map.on("draw:created", this.shapesToWKT, this);

@@ -94,6 +91,20 @@ export default L.Control.AstroDrawControl = L.Control.Draw.extend({
    return container;
  },

  /**
   * 
   * 
   */
  copyToClipboard: function(){
    /* Get the text field */
    var copyText = document.getElementById("query-textarea");

    copyText.select();
    copyText.setSelectionRange(0, 99999); /* For mobile devices */

    navigator.clipboard.writeText(copyText.value);
  },

  /**
   * @function AstroDrawControl.prototype.shapesToWKT
   * @description Is called when a user draws a shape using the on map drawing features.
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import AstroProj from "./AstroProj";
import LayerCollection from "./LayerCollection";
import { getItemCollection, setNumberMatched, setMaxNumberPages, getCurrentPage, setCurrentPage, setFeatures} from "./ApiJsonCollection";
import { MY_JSON_MAPS } from "./layers";
import stacLayer from 'stac-layer/src/index.js';
// import stacLayer from 'stac-layer/src/index.js';


/**