Unverified Commit c669e0aa authored by amystamile's avatar amystamile Committed by GitHub
Browse files

Merge pull request #48 from gsn9/consoleButtons

Console buttons
parents 941ddf17 3a849be8
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ import { alpha } from "@mui/material/styles";
import Button from "@mui/material/Button";
import ButtonGroup from "@mui/material/ButtonGroup";
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import PolylineIcon from '@mui/icons-material/Polyline';
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import SwitchLeftIcon from '@mui/icons-material/SwitchLeft';
import SwitchRightIcon from '@mui/icons-material/SwitchRight';
@@ -64,9 +63,8 @@ export default function QueryConsole() {
                orientation="vertical"
                size="small"
                variant="contained">
                <Button 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="copyCodeButton" sx={css.button} startIcon={<ContentCopyIcon />}>Copy Code</Button>
                <Button id="runQueryButton" sx={css.button} startIcon={<PlayArrowIcon />}>Run STAC Query</Button>
              </ButtonGroup>
            </div>
          </div>
+17 −9
Original line number Diff line number Diff line
@@ -74,9 +74,6 @@ export default L.Control.AstroDrawControl = L.Control.Draw.extend({
    this.wkt = new Wkt.Wkt();
    this.myLayer = L.Proj.geoJson().addTo(map);

    this.wktButton = L.DomUtil.get("wktButton");
    L.DomEvent.on(this.wktButton, "click", this.mapWKTString, this);

    L.DomEvent.on(
      L.DomUtil.get("applyChip"),
      "click",
@@ -84,13 +81,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);

@@ -99,6 +93,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.
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ import { getItemCollection,
         setFeatures,
         setNumberReturned } from "./ApiJsonCollection";
import { MY_JSON_MAPS } from "./layers";
import stacLayer from 'stac-layer/src/index.js';


/**