From 1f7786a50303d49f54fa713b540b176131faf971 Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Thu, 2 Jun 2022 23:10:42 -0500 Subject: Add mapa v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mapa con algunos punto - Zoom al mapa xdddd - Punto que se mueve #TODO - añadir todos los puntos - Mejorar el path del punto con funcion - añadir tiempos segun distancia - estetica al final (camion, colores, etc) --- front/odiparpack/app/containers/App/Application.js | 4 +- .../Odipar/Simulacion/Simulacion7Dias.js | 81 +++++++ .../app/containers/Odipar/Simulacion/utilCoords.js | 42 ++++ front/odiparpack/app/containers/pageListAsync.js | 6 + front/odiparpack/app/index.html | 2 + front/odiparpack/app/utils/odipar/constants.js | 5 +- front/odiparpack/app/utils/odipar/menu.js | 2 +- front/odiparpack/package-lock.json | 5 + front/odiparpack/package.json | 1 + front/odiparpack/public/images/mapa.png | Bin 0 -> 144573 bytes front/odiparpack/public/images/mapa.svg | 238 +++++++++++++++++++++ front/odiparpack/public/images/mapa2.png | Bin 0 -> 144219 bytes front/odiparpack/public/images/mapaGrande.jpg | Bin 0 -> 161979 bytes front/odiparpack/public/images/mapaM.png | Bin 0 -> 125691 bytes 14 files changed, 383 insertions(+), 3 deletions(-) create mode 100644 front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js create mode 100644 front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js create mode 100644 front/odiparpack/public/images/mapa.png create mode 100644 front/odiparpack/public/images/mapa.svg create mode 100644 front/odiparpack/public/images/mapa2.png create mode 100644 front/odiparpack/public/images/mapaGrande.jpg create mode 100644 front/odiparpack/public/images/mapaM.png diff --git a/front/odiparpack/app/containers/App/Application.js b/front/odiparpack/app/containers/App/Application.js index 6ab9d34..685228d 100644 --- a/front/odiparpack/app/containers/App/Application.js +++ b/front/odiparpack/app/containers/App/Application.js @@ -29,7 +29,8 @@ import { Pedidos, Almacenes, Camiones, - Tramos + Tramos, + Simulacion7Dias } from '../pageListAsync'; function Application(props) { @@ -41,6 +42,7 @@ function Application(props) { {/* OdiparPack */} + diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js new file mode 100644 index 0000000..eff6d5d --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Simulacion/Simulacion7Dias.js @@ -0,0 +1,81 @@ +import React, { Component } from "react"; +import { withStyles } from '@material-ui/core/styles'; +import {getX, getY} from './utilCoords' +import { Icon } from "@material-ui/core"; +import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; +import { mapaH, mapaW } from "odi-utils/constants" + +const styles = ({ + root: { + flexGrow: 1, + marginTop: 30, + } + }); + + +class Simulacion7Dias extends Component { + almacenes = [ + { + ubigeo: '150101', + provincia: 'LIMA', + latitud:-12.04591952, + longitud: -77.03049615, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '130101', + provincia: 'TRUJILLO', + latitud: -8.11176389, + longitud: -79.02868652, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '040101', + provincia: 'AREQUIPA', + latitud:-16.39881421, + longitud: -71.537019649, + region: 'Costa', + esPrincipal: 1 + },{ + ubigeo: '050301', + provincia: 'HUANCA SANCOS', + latitud:-13.91988366, + longitud: -74.33388289, + region: 'Costa', + esPrincipal: 0 + } + ] + render() { + return ( + + +
+ + {this.almacenes.map((item,index) => { + console.log(index) + return
+ house +
+ })} +
+ + + + + + +
+
+ + ); + } +} + +export default withStyles(styles)(Simulacion7Dias); \ No newline at end of file diff --git a/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js b/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js new file mode 100644 index 0000000..bac5f9b --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Simulacion/utilCoords.js @@ -0,0 +1,42 @@ +import { mapaH, mapaW } from "odi-utils/constants" +export function transform(lonlat){ + const earth_radius_km = 6378.1370 + return earth_radius_km*(lonlat)*Math.PI/180 +} + + +export function limits(type){ + const inferior={lon:-81.324216, lat: -18.345605} + const superior={lon:-68.654087, lat:-0.043656} + + if (type == 'x'){ + return [transform(inferior.lon), transform(superior.lon)] + } + return [transform(inferior.lat),transform(superior.lat)] + +} + +//inicio de mapa en x = 13 y = 33 +export function getX (lon){ + const [infx, supx] = limits('x'); + const imgW = mapaW + const inicioX= -3 + const Fx = Math.abs(infx) - Math.abs(supx) + const xPrev = transform(lon) + const newX = Math.abs(infx) - Math.abs(xPrev) + const x = Math.trunc((Math.abs(newX)*(imgW))/(Fx)) + console.log("x: ", x + 0) + return x + inicioX; +} + +export function getY (lat){ + const [ infy, supy] = limits('y'); + const imgH = mapaH + const inicioY = -8 + const Fy = Math.abs(infy) - Math.abs(supy) + const yPrev = transform(lat) + const newY = Math.abs(yPrev) - Math.abs(supy) + const y = Math.trunc((Math.abs(newY)*(imgH))/(Fy)) + console.log("y: ", y +0) + return y + inicioY + } \ No newline at end of file diff --git a/front/odiparpack/app/containers/pageListAsync.js b/front/odiparpack/app/containers/pageListAsync.js index b64c622..324b633 100644 --- a/front/odiparpack/app/containers/pageListAsync.js +++ b/front/odiparpack/app/containers/pageListAsync.js @@ -1,6 +1,12 @@ import Loadable from 'react-loadable'; import Loading from 'ba-components/Loading'; +// 2.Pedidos +export const Simulacion7Dias = Loadable({ + loader: () => import('./Odipar/Simulacion/Simulacion7Dias'), + loading: Loading, +}); + // 2.Pedidos export const Pedidos = Loadable({ loader: () => import('./Odipar/Pedidos/Pedidos'), diff --git a/front/odiparpack/app/index.html b/front/odiparpack/app/index.html index 74ddd5a..ad0121d 100644 --- a/front/odiparpack/app/index.html +++ b/front/odiparpack/app/index.html @@ -28,6 +28,8 @@ + diff --git a/front/odiparpack/app/utils/odipar/constants.js b/front/odiparpack/app/utils/odipar/constants.js index 73f3521..d4b2d1b 100644 --- a/front/odiparpack/app/utils/odipar/constants.js +++ b/front/odiparpack/app/utils/odipar/constants.js @@ -6,4 +6,7 @@ export function partial(fn, ...presetArgs) { return function partiallyApplied(...laterArgs) { return fn(...presetArgs, ...laterArgs); }; -} \ No newline at end of file +} + +export const mapaH = 718 +export const mapaW = 498 \ No newline at end of file diff --git a/front/odiparpack/app/utils/odipar/menu.js b/front/odiparpack/app/utils/odipar/menu.js index cf032e9..13c5258 100644 --- a/front/odiparpack/app/utils/odipar/menu.js +++ b/front/odiparpack/app/utils/odipar/menu.js @@ -3,7 +3,7 @@ module.exports = [ key: 'seguimiento', name: 'Seguimiento', icon: 'near_me', - link: '/app/dashboard-v2', + link: '/app/simulacion', child: [ ] }, { diff --git a/front/odiparpack/package-lock.json b/front/odiparpack/package-lock.json index 28b80be..096bf9a 100644 --- a/front/odiparpack/package-lock.json +++ b/front/odiparpack/package-lock.json @@ -14983,6 +14983,11 @@ "ultimate-pagination": "1.0.0" } }, + "react-zoom-pan-pinch": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-2.1.3.tgz", + "integrity": "sha512-a5AChOWhjo0RmxsNZXGQIlNh3e3nLU6m4V6M+6dlbPNk5d+MtMxgKWyA5zpR06Lp3OZkZVF9nR8JeWSvKwck9g==" + }, "read-chunk": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-1.0.1.tgz", diff --git a/front/odiparpack/package.json b/front/odiparpack/package.json index d2cde1e..83888ba 100644 --- a/front/odiparpack/package.json +++ b/front/odiparpack/package.json @@ -169,6 +169,7 @@ "react-syntax-highlighter": "^7.0.0", "react-text-mask": "^5.3.2", "react-ultimate-pagination": "^1.2.0", + "react-zoom-pan-pinch": "^2.1.3", "recharts": "^1.5.0", "recompose": "^0.28.2", "redux": "4.0.1", diff --git a/front/odiparpack/public/images/mapa.png b/front/odiparpack/public/images/mapa.png new file mode 100644 index 0000000..a8b2b07 Binary files /dev/null and b/front/odiparpack/public/images/mapa.png differ diff --git a/front/odiparpack/public/images/mapa.svg b/front/odiparpack/public/images/mapa.svg new file mode 100644 index 0000000..bee29c1 --- /dev/null +++ b/front/odiparpack/public/images/mapa.svg @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/front/odiparpack/public/images/mapa2.png b/front/odiparpack/public/images/mapa2.png new file mode 100644 index 0000000..376ad36 Binary files /dev/null and b/front/odiparpack/public/images/mapa2.png differ diff --git a/front/odiparpack/public/images/mapaGrande.jpg b/front/odiparpack/public/images/mapaGrande.jpg new file mode 100644 index 0000000..be60da3 Binary files /dev/null and b/front/odiparpack/public/images/mapaGrande.jpg differ diff --git a/front/odiparpack/public/images/mapaM.png b/front/odiparpack/public/images/mapaM.png new file mode 100644 index 0000000..61e2f13 Binary files /dev/null and b/front/odiparpack/public/images/mapaM.png differ -- cgit v1.2.3