Commit 9bd1ae60 authored by Mattias J Duffy's avatar Mattias J Duffy
Browse files

adding max bounds for other campuses besides fairfax

parent a16bb914
...@@ -24,9 +24,11 @@ const Mark = { ...@@ -24,9 +24,11 @@ const Mark = {
class FacilitiesMap extends React.Component { class FacilitiesMap extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const maxBounds = getMaxBounds(props.campusRegion);
const southWestBounds = [-77.321649, 38.823919]; //Coordinates for the south-west bound // const southWestBounds = [-77.321649, 38.823919]; //Coordinates for the south-west bound
const northEastBounds = [-77.295213, 38.835720]; //Coordinates for the north-east bound // const northEastBounds = [-77.295213, 38.835720]; //Coordinates for the north-east bound
const southWestBounds = maxBounds[0]; //Coordinates for the south-west bound
const northEastBounds = maxBounds[1]; //Coordinates for the north-east bound
this.state = { this.state = {
positionReady: false, positionReady: false,
...@@ -36,7 +38,7 @@ class FacilitiesMap extends React.Component { ...@@ -36,7 +38,7 @@ class FacilitiesMap extends React.Component {
}, },
mappedRoute: false, mappedRoute: false,
fitBounds: [southWestBounds, northEastBounds], fitBounds: [southWestBounds, northEastBounds],
maxBounds: getMaxBounds(), maxBounds: maxBounds,
fitBoundsOptions: {}, fitBoundsOptions: {},
mapDialogOpen: false mapDialogOpen: false
}; };
......
...@@ -10,7 +10,7 @@ import MapDialog from './MapDialog'; ...@@ -10,7 +10,7 @@ import MapDialog from './MapDialog';
import CloseIcon from 'material-ui-icons/Close'; import CloseIcon from 'material-ui-icons/Close';
import IconButton from 'material-ui/IconButton'; import IconButton from 'material-ui/IconButton';
import LocationOnIcon from 'material-ui-icons/LocationOn'; import LocationOnIcon from 'material-ui-icons/LocationOn';
import {getMaxBounds} from '../utils/mapboxUtils'; // import {getMaxBounds} from '../utils/mapboxUtils';
import {removeBrackets} from '../utils/nameUtils'; import {removeBrackets} from '../utils/nameUtils';
class FacilityDialog extends React.Component { class FacilityDialog extends React.Component {
...@@ -20,7 +20,7 @@ class FacilityDialog extends React.Component { ...@@ -20,7 +20,7 @@ class FacilityDialog extends React.Component {
this.state = { this.state = {
isMapOpen: false, isMapOpen: false,
maxBounds: getMaxBounds() maxBounds: props.maxBounds,
}; };
} }
......
...@@ -12,7 +12,7 @@ import CloseIcon from 'material-ui-icons/Close'; ...@@ -12,7 +12,7 @@ import CloseIcon from 'material-ui-icons/Close';
import IconButton from 'material-ui/IconButton'; import IconButton from 'material-ui/IconButton';
import {removeBrackets} from '../utils/nameUtils'; import {removeBrackets} from '../utils/nameUtils';
const Sidebar = ({facility, isSidebarOpen, facilities, setSidebar, setSelectedFacility}) => { const Sidebar = ({facility, isSidebarOpen, facilities, setSidebar, setSelectedFacility, campusRegion}) => {
const handleSidebarClose = () => { const handleSidebarClose = () => {
setSelectedFacility(null); setSelectedFacility(null);
...@@ -47,7 +47,7 @@ const Sidebar = ({facility, isSidebarOpen, facilities, setSidebar, setSelectedFa ...@@ -47,7 +47,7 @@ const Sidebar = ({facility, isSidebarOpen, facilities, setSidebar, setSelectedFa
</div> </div>
</div> </div>
<div className={'sidebar-row2'}> <div className={'sidebar-row2'}>
<FacilitiesMap facilities={facilities} facility={facility} /> <FacilitiesMap facilities={facilities} facility={facility} campusRegion={campusRegion} />
</div> </div>
</Paper> </Paper>
</div> </div>
......
...@@ -51,7 +51,7 @@ class Layout extends React.Component { ...@@ -51,7 +51,7 @@ class Layout extends React.Component {
</div> </div>
</div> </div>
<Sidebar facilities={facilities} facility={selectedFacility} isSidebarOpen={isSidebarOpen} setSidebar={setSidebar} setSelectedFacility={setSelectedFacility}/> <Sidebar facilities={facilities} facility={selectedFacility} isSidebarOpen={isSidebarOpen} setSidebar={setSidebar} setSelectedFacility={setSelectedFacility} campusRegion={campusRegion}/>
</div> </div>
</div> </div>
); );
......
const campusBounds = {
fairfax: [
[-77.321649, 38.823919], // Southwest coordinates
[-77.295213, 38.835720] // Northeast coordinates
],
arlington: [
[-77.10344017, 38.88401789],
[-77.09945977, 38.88638969]
],
'prince william county science and technology': [
[-77.52532482, 38.75497015],
[-77.51772881, 38.75983938]
],
'mason korea': [
[126.65918827, 37.37121447],
[126.68343544, 37.38836766]
]
};
/** /**
* paints geojson data onto map * paints geojson data onto map
* *
...@@ -55,7 +73,10 @@ const getGeoLine = (mapboxClient, start, end) => { ...@@ -55,7 +73,10 @@ const getGeoLine = (mapboxClient, start, end) => {
* *
* @returns {array} the bounds of the George Mason Fairfax Campus * @returns {array} the bounds of the George Mason Fairfax Campus
*/ */
const getMaxBounds = () => { const getMaxBounds = (campus) => {
console.log('holy fuck this is working');
console.log(campus);
console.log(campusBounds[campus]);
return [ return [
[-77.321649, 38.823919], // Southwest coordinates [-77.321649, 38.823919], // Southwest coordinates
[-77.295213, 38.835720] // Northeast coordinates [-77.295213, 38.835720] // Northeast coordinates
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment