Skip to content

Commit

Permalink
pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
eflowbeach committed Oct 11, 2016
1 parent 7788a82 commit 109c47e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 77 deletions.
15 changes: 8 additions & 7 deletions source/class/mobileedd/MoreLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ qx.Class.define("mobileedd.MoreLayers",
{
var me = this;
Object.keys(me.layers).forEach(function(obj) {
try{
if (bool) {
me.html[obj].setVisibility('visible');
} else {
me.html[obj].setVisibility('excluded');
}
}catch(e){
try {
if (bool) {
me.html[obj].setVisibility('visible');
} else {
me.html[obj].setVisibility('excluded');
}
}catch (e)
{
//not defined
}
})
Expand Down
5 changes: 2 additions & 3 deletions source/class/mobileedd/Radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ qx.Class.define("mobileedd.Radar",
init : 5,
apply : "changeFrames"
},
active:
{
init: true
active : {
init : true
}
},
construct : function()
Expand Down
14 changes: 7 additions & 7 deletions source/class/mobileedd/RadarPhase.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ qx.Class.define("mobileedd.RadarPhase",
init : 5,
apply : "changeFrames"
},
active:
{
init: false
active : {
init : false
}
},
construct : function()
Expand Down Expand Up @@ -59,6 +58,7 @@ qx.Class.define("mobileedd.RadarPhase",
});

// Set up the query timestamp request

// Need to use EDD's since UW's server doesn't serve the correct response type: text/json rather than application/json
me.timesReq = new qx.io.request.Jsonp("http://preview.weather.gov/edd/resource/edd/universities/getUWVectorTimes.php?layer=nexrphase");

Expand Down Expand Up @@ -225,7 +225,7 @@ qx.Class.define("mobileedd.RadarPhase",
Object.keys(me.radarPhaseLayers).sort().forEach(function(obj, index) {
if (me.getSliderIndex() == index)
{
me.timeMessage.setData(new moment.utc(obj,"YYYYMMDD.HHmmss").toDate());
me.timeMessage.setData(new moment.utc(obj, "YYYYMMDD.HHmmss").toDate());
me.bus.dispatch(me.timeMessage);
}
}, this);
Expand All @@ -244,12 +244,12 @@ qx.Class.define("mobileedd.RadarPhase",
me.radarPhaseLayers[time] = new ol.layer.Tile(
{
name : "UW - " + time,
source : new ol.source.XYZ(
{
url : me.c.getSecure() + '//realearth.ssec.wisc.edu/proxy/image.php?products=nexrphase_' + time.replace('.','_') + '&x={x}&y={y}&z={z}'
source : new ol.source.XYZ( {
url : me.c.getSecure() + '//realearth.ssec.wisc.edu/proxy/image.php?products=nexrphase_' + time.replace('.', '_') + '&x={x}&y={y}&z={z}'
})
});
me.map.addLayer(me.radarPhaseLayers[time]);

// me.radarPhaseLayers[time].setVisible(false);
me.radarPhaseLayers[time].setOpacity(me.getOpacity());

Expand Down
100 changes: 42 additions & 58 deletions source/class/mobileedd/page/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ qx.Class.define("mobileedd.page.Map",
/**
* Mapping Library
* */

me.setMapUri("resource/mobileedd/ol.js");

//me.setMapUri("resource/mobileedd/ol-debug.js");

// Warning types
Expand Down Expand Up @@ -378,8 +378,6 @@ qx.Class.define("mobileedd.page.Map",
var me = this;
this.base(arguments);
this._loadMapLibrary();



// me.drawer
me.drawer = new qx.ui.mobile.container.Drawer();
Expand Down Expand Up @@ -481,8 +479,7 @@ qx.Class.define("mobileedd.page.Map",
me.radarContainer = new qx.ui.mobile.container.Composite();
me.radarContainer.setLayout(new qx.ui.mobile.layout.VBox());


// Precipitation Type
// Precipitation Type
var radarPhaseComposite = new qx.ui.mobile.container.Composite();
radarPhaseComposite.setLayout(new qx.ui.mobile.layout.HBox());
me.phaseControl = new qx.ui.mobile.form.ToggleButton(false, "Yes", "No");
Expand Down Expand Up @@ -582,34 +579,33 @@ qx.Class.define("mobileedd.page.Map",
});
me.radarLoopSlider.addListener("changeValue", function(e)
{
var uwRadar = mobileedd.RadarPhase.getInstance();
var radarMrms = mobileedd.Radar.getInstance();
if(me.phaseControl.getValue()){
if(radarMrms.getActive()){
radarMrms.stop(true);
var uwRadar = mobileedd.RadarPhase.getInstance();
var radarMrms = mobileedd.Radar.getInstance();

// Handle which source is active Radar precip or MRMS
if (me.phaseControl.getValue())
{
if (radarMrms.getActive())
{
radarMrms.stop(true);
radarMrms.setActive(false);
uwRadar.setActive(true);
uwRadar.start();
me.radarLegendImage.setSource(me.c.getSecure() + "//realearth.ssec.wisc.edu/proxy/legend.php?products=nexrphase");
}



uwRadar.setSliderIndex(e.getData());

}else{
if(uwRadar.getActive()){
uwRadar.stop(true);
} else
{
if (uwRadar.getActive())
{
uwRadar.stop(true);
uwRadar.setActive(false);
radarMrms.setActive(true);
radarMrms.start();
me.radarLegendImage.setSource("resource/mobileedd/images/legend/radar.png");
}
radarMrms.setSliderIndex(e.getData());
}



}, this);
radarLoopSliderComposite.add(me.radarLoopSlider, {
flex : 1
Expand Down Expand Up @@ -1168,12 +1164,11 @@ qx.Class.define("mobileedd.page.Map",
items.push('Cancel');
var model = new qx.data.Array(items);
var menu = new qx.ui.mobile.dialog.Menu(model);
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2)
{
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2) {
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
menu.show();

// Loop through More Layers layers to find which ones are selected then color the background green
Expand Down Expand Up @@ -1211,12 +1206,11 @@ qx.Class.define("mobileedd.page.Map",
subitems.push('Cancel');
var submodel = new qx.data.Array(subitems);
var submenu = new qx.ui.mobile.dialog.Menu(submodel);
new qx.bom.Selector.query('li>div>div', submenu.getContainerElement()).forEach(function(div, index2)
{
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', submenu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
new qx.bom.Selector.query('li>div>div', submenu.getContainerElement()).forEach(function(div, index2) {
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', submenu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
submenu.show();

// Loop through More Layers layers to find which ones are selected then color the background green
Expand Down Expand Up @@ -1288,12 +1282,11 @@ qx.Class.define("mobileedd.page.Map",
options.push('Cancel');
var model = new qx.data.Array(options);
var menu = new qx.ui.mobile.dialog.Menu(model);
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2)
{
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2) {
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
menu.show();
menu.addListener("changeSelection", function(evt)
{
Expand Down Expand Up @@ -1422,16 +1415,13 @@ qx.Class.define("mobileedd.page.Map",
}, this);
scrollContainer.add(showPopupButton);


/**
* Feedback
* */
/**
* Feedback
* */
var feedbackButton = new qx.ui.mobile.form.Button("Feedback", "resource/mobileedd/images/feedback.png");
feedbackButton.addListener("tap", function(e)
{
feedbackButton.addListener("tap", function(e) {
window.open('http://www.nws.noaa.gov/survey/nws-survey.php?code=EEDD', '_blank');
}, this);

scrollContainer.add(feedbackButton);

/**
Expand Down Expand Up @@ -1514,6 +1504,7 @@ qx.Class.define("mobileedd.page.Map",
var me = this;
me.loopControl.setValue(false);
me.radarToggleButton.setValue(false);

// me.phaseControl.setValue(false);

// me.longLoop.setValue(false);
Expand Down Expand Up @@ -1584,7 +1575,7 @@ qx.Class.define("mobileedd.page.Map",
url += '&r=';
url += me.radarToggleButton.getValue() ? 'T' : 'F';
url += '&pc=';
url += me.phaseControl.getValue() ? 'T' :'F';
url += me.phaseControl.getValue() ? 'T' : 'F';

// url += '&rll=';

Expand Down Expand Up @@ -1708,7 +1699,6 @@ qx.Class.define("mobileedd.page.Map",
me.loopControl.setValue(bool);
var bool = me.getURLParameter('r') == "T" ? true : false;
me.radarToggleButton.setValue(bool);

var bool = me.getURLParameter('pc') == "T" ? true : false;
me.phaseControl.setValue(bool);

Expand Down Expand Up @@ -2475,11 +2465,6 @@ qx.Class.define("mobileedd.page.Map",
// Add state overlay

//me.addStatesLayer();





}.bind(this);
req.open("GET", this.getMapUri());
req.send();
Expand Down Expand Up @@ -2865,12 +2850,11 @@ qx.Class.define("mobileedd.page.Map",
items.push('Cancel');
var model = new qx.data.Array(items);
var menu = new qx.ui.mobile.dialog.Menu(model);
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2)
{
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
new qx.bom.Selector.query('li>div>div', menu.getContainerElement()).forEach(function(div, index2) {
if (div.innerHTML.indexOf("Cancel") !== -1) {
qx.bom.element.Style.setCss(new qx.bom.Selector.query('li', menu.getContainerElement())[index2 / 2], 'color:blue;')
}
})
menu.show();
menu.addListener("changeSelection", function(evt)
{
Expand Down
6 changes: 4 additions & 2 deletions source/class/mobileedd/page/PageTravelHazards.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/*global qx*/

/*global ol*/

/*global moment*/

/**
Expand All @@ -34,11 +35,12 @@ qx.Class.define("mobileedd.page.PageTravelHazards",
}

// Putting these up here so they're not as annoying to the user to have to initialize the travel instance
// Origin

// Origin
this.__start = new qx.ui.mobile.form.TextField().set( {
placeholder : "Type location or tap the map."
});

// Destination
this.__end = new qx.ui.mobile.form.TextField().set( {
placeholder : "Type location or tap the map."
Expand Down

0 comments on commit 109c47e

Please sign in to comment.