bing map v7 control buttons - bing-maps

I am using bing map in my web application using api-reference7
i i have left,right,up,down buttons and i want user when click on these buttons they should behave as buttons on the control buttons.

var NAVIG_MAP_LEFT=1;var NAVIG_MAP_RIGHT=2;var NAVIG_MAP_TOP=3;var NAVIG_MAP_BOTTOM=4;
var NAVIG_MAP_STEP=100;
function navigateMap(n, step){
var loc = bingMap.getCenter();
var locToPx = bingMap.tryLocationToPixel(loc);
switch(n){
case NAVIG_MAP_LEFT: locToPx.x = locToPx.x-step; break;
case NAVIG_MAP_RIGHT: locToPx.x = locToPx.x+step; break;
case NAVIG_MAP_TOP: locToPx.y = locToPx.y+step; break;
case NAVIG_MAP_BOTTOM: locToPx.y = locToPx.y-step; break;
}
loc = bingMap.tryPixelToLocation(locToPx);
bingMap.setView({center: loc});
}

Related

How to get selected layers in control.layers?

Is there a way to select all selected layers in the control.layers with leaflet api?
I can do it with the help of jquery like this :
$('.leaflet-control-layers-selector:checked')
But maybe there is an api?
Thanks
There is no API for that but you could easily create one yourself:
// Add method to layer control class
L.Control.Layers.include({
getActiveOverlays: function () {
// Create array for holding active layers
var active = [];
// Iterate all layers in control
this._layers.forEach(function (obj) {
// Check if it's an overlay and added to the map
if (obj.overlay && this._map.hasLayer(obj.layer)) {
// Push layer to active array
active.push(obj.layer);
}
});
// Return array
return active;
}
});
var control = new L.Control.Layers(...),
active = control.getActiveOverlays();
Based on iH8's answer
L.Control.Layers.include({
getOverlays: function() {
// create hash to hold all layers
var control, layers;
layers = {};
control = this;
// loop thru all layers in control
control._layers.forEach(function(obj) {
var layerName;
// check if layer is an overlay
if (obj.overlay) {
// get name of overlay
layerName = obj.name;
// store whether it's present on the map or not
return layers[layerName] = control._map.hasLayer(obj.layer);
}
});
return layers;
}
});
Now you can use
var control = new L.Control.Layers(...)
control.getOverlays(); // { Truck 1: true, Truck 2: false, Truck 3: false }
I find this a little more useful because
all the layers are included
the key is the name of the layer
if the layer is showing, it has a value of of true, else false

syncfusion chart background line will be dotted line

I want my chart backgroud line will be dotted. Which property can i use for dotted in syncfusion? I tried but i coudn't do this. I don't know exactly which propertly will use for dotted line.
Here is my code:
control.AutoTempFileCleanUp = true;
control.OutputFormat = ImageProviderOutputFormat.DiskFile;
control.Model.Series.Clear();
ChartModel chartModel = new ChartModel();
ChartSeries chart = new ChartSeries(yAxisBar1LegendName, ChartSeriesType.Column);
chart.Text = yAxisBar1LegendName;
control.ChartArea.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;
// = string.Format("");
control.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("", Color.Black, new Font("Arial", 10), 0, "", ChartValueType.Custom));
int counter = 1;
DoubleRange dr = new DoubleRange(1, 100);
foreach (DataRow row in ds.Tables[0].Rows)
{
double bar1Value = Convert.ToDouble(row[yAxisValueColumn1]);
chart.Points.Add(counter, bar1Value);
control.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel(row["ModuleCode"].ToString(), Color.Black, new Font("Arial", 10), counter, "", ChartValueType.Custom));
counter++;
}
chart.PrepareStyle += new ChartPrepareStyleInfoHandler(series_PrepareStyle);
control.ChartArea.PrimaryXAxis.DrawGrid = false;
control.PrimaryXAxis.GridLineType.ForeColor = Color.DarkGray;
control.PrimaryYAxis.GridLineType.ForeColor = Color.DarkGray;
control.PrimaryXAxis.LineType.ForeColor = Color.DarkGray;
control.PrimaryYAxis.LineType.ForeColor = Color.DarkGray;
control.Text = chartHeader;
control.ChartArea.PrimaryYAxis.Title = yAxisText;
control.ChartArea.PrimaryXAxis.Title = xAxisText;
control.ChartArea.PrimaryXAxis.TitleAlignment = StringAlignment.Center;
control.ChartArea.PrimaryXAxis.IsVisible = true;
control.ChartArea.PrimaryXAxis.LabelAlignment = StringAlignment.Center;
control.ChartArea.PrimaryXAxis.VisibleRange.Min = 0;
control.ChartArea.PrimaryXAxis.VisibleRange.Max = counter;
control.ChartArea.PrimaryXAxis.VisibleRange.Interval = 1;
control.ChartArea.PrimaryYAxis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Center;
control.ChartArea.PrimaryYAxis.GridDrawMode = ChartAxisGridDrawingMode.Default;
//control.PrimaryXAxis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Center;
control.PrimaryXAxis.Font = new Font("Arial", 10F);
control.PrimaryYAxis.Font = new Font("Arial", 10F);
counter = 0;
foreach (ChartSeries series in control.Series)
{
Color color;
if (counter == 0)
{
color = Color.Green;
else
{
color = Color.Red;
}
series.Style.Interior = new BrushInfo(color);
series.Style.Border.Color = Color.DarkGray;
series.Style.Font.Bold = true;
series.Style.TextColor = Color.Black;
series.Style.TextOrientation = ChartTextOrientation.Left;
series.Style.TextFormat = "{0}";
counter++;
}
control.Width = 650;
control.Series3D = false;
control.ShowLegend = false;
control.BorderStyle = BorderStyle.None;
control.BorderAppearance.SkinStyle = ChartBorderSkinStyle.None;
//control.Legend.Alignment = ChartAlignment.Far;
}
Here is my chart image:
Thanks for using syncfusion products.
We have analyzed your query. If you want to customize the grid lines in axis, then you can use the “DashStyle” property in GridLineType which property is used to change the line style. And you can also specify the grid line style as Dash, DashDot, DashDotDot, Dot, Solid in axis.
And please find the below code snippet
this.ChartWebControl1.PrimaryYAxis.GridLineType.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
And we have also prepared a sample for your reference in ASP.NET classic platform and attached in the below location.
Sample Link : http://www.syncfusion.com/downloads/support/directtrac/160606/ze/Sample1273790903
Please find the output of the sample below:
And also we wish to let you know that the above mentioned property is also applicable for chart control in windows forms, ASP.NET classic and ASP.NET MVC classic platforms.
Please contact us via syncfusion support, if you have any queries related to using syncfusion products.

Use drag 'n' drop in nativescript

I want to have the drag'n'drop functionality on some labels that are positioned with a absolute layout in a nativescript app. Is it even possible to move them in a new absolute position using drag'n'drop? If yes, can you explain a way to achieve this?
Thank you in advance.
After a little research I found out that you can achieve this with the following steps:
Define an Absolute Layout
Inside it place a label
On the label observer the pan gesture
using the deltaX and deltaY you can change the left and top values of the label using the static method setLeft() and setTop() of absolute layout on the label.
Sample xml:
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
<AbsoluteLayout>
<Label left="10" top="10" text="drag me" id="dragLabel" />
</AbsoluteLayout>
</Page>
Sample js code:
var viewModule = require("ui/core/view");
var gestures = require("ui/gestures");
var absoluteLayout = require("ui/layouts/absolute-layout");
function pageLoaded(args) {
var page = args.object;
var dragLabel = viewModule.getViewById(page, "dragLabel");
var observer = dragLabel.observe(gestures.GestureTypes.pan, function (panGestureEventData) {
var deltaX = panGestureEventData.deltaX;
var deltaY = panGestureEventData.deltaY;
absoluteLayout.AbsoluteLayout.setTop(this, deltaY);
absoluteLayout.AbsoluteLayout.setLeft(this, deltaX);
}, dragLabel);
};
Also, nativescript in the current version (1.2.x) doesn't support the state in the gestures. In the pan gesture, the state is really necessary to know. Here is what you can do (in ios), so you can get the state. Edit the file /tns_modules/ui/gestures/gestures.ios.js and change the function _getPanData with the following:
function _getPanData(args, view) {
var recognizer = args.ios;
var state = "unknown";
switch(recognizer.state) {
case UIGestureRecognizerStateBegan:
state = "began";
break;
case UIGestureRecognizerStateChanged:
state = "changed";
break;
case UIGestureRecognizerStateEnded:
state = "ended";
break;
case UIGestureRecognizerStateCancelled:
state = "cancelled";
break;
case UIGestureRecognizerStateFailed:
state = "failed";
break;
}
return {
type: args.type,
view: args.view,
ios: args.ios,
android: undefined,
deltaX: recognizer.translationInView(view).x,
deltaY: recognizer.translationInView(view).y,
state: state
};
}
Then, you can access the state with the state field:
var observer = dragLabel.observe(gestures.GestureTypes.pan, function (panGestureEventData) {
// ... panGestureEventData.state has on of the above values...
});

How to setting limit to show pushpin

I have a map of bing maps and I use has created pushpin do with double click. And now I want to make limits pushpin only <= 20.
If it has been over the limit point is then automatically pushpin cannot be displayed. Although double click in map.
But I don't understand how to create it. Can you help me? Thanks a lot. Gbu.
My code to show pushpin
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);
Microsoft.Maps.Events.addHandler(map, 'dblclick',getLatlng );
}
//show pushpin
function getLatlng(e) {
if (e.targetType == "map")
{
var point = new Microsoft.Maps.Point(e.getX(), e.getY());
var locTemp = e.target.tryPixelToLocation(point);
var location = new Microsoft.Maps.Location(locTemp.latitude, locTemp.longitude);
alert(locTemp.latitude + "&" + locTemp.longitude);
var pin = new Microsoft.Maps.Pushpin(location, { 'draggable': false });
map.entities.push(pin);
alert("Done");
Microsoft.Maps.event.addListener(map, 'click', function (event)
{
}
// limit pushpin
*How to create limit pushpin?*
In the getlatlng function you can do a simple check to see how many shapes are on the map. You can get the number of shapes on the map in your application by doing the following:
var cnt = map.entities.getLength();

Unity3d Windows Phone Live Tile

How do we implement live tile in Unity3d Windows Phone??
I want the live tile show the current high score.
I have tried this:
#if UNITY_METRO
UnityEngine.WSA.Tile liveTile = Tile.main;
//then we update the tile with our latest high score
//the first three strings are for images (medium,wide,large)
//the last string is for text to display
//you can also pass in an XML file to describe the tile
liveTile.Update("","","", "Best round time: " + PlayerPrefs.GetInt("angka", 0));
#endif
I don't work for Prime 31. I attended the Unity 5 Roadshow and found out Prime 31 is giving away their Windows Phone and Store plug-ins for free (not sure for how long, they have a deal with Microsoft).
prime31.com
They do have support for titles in their Metro Essentials Plugin
Here is the code that is included in the demo...
if( GUILayout.Button( "Update Application Live Tile (standard)" ) )
{
// first, create the tile data
var tileData = new StandardTileData();
tileData.backContent = "I'm on the back";
tileData.backTitle = "BACK TITLE";
tileData.title = "Live Tile Title";
tileData.count = 12;
// now update the tile
Tiles.updateApplicationTile( tileData );
}
if( GUILayout.Button( "Create Live Tile (Flip)" ) )
{
// first, create the tile data
var tileData = new FlipTileData();
tileData.backContent = "Back of the Tile";
tileData.backBackgroundImage = "http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Breastfeeding-icon-med.svg/202px-Breastfeeding-icon-med.svg.png";
tileData.backTitle = "Back Title Here";
tileData.backgroundImage = "http://cdn.memegenerator.net/instances/250x250/38333070.jpg";
tileData.smallBackgroundImage = "Assets/Tiles/FlipCycleTileSmall.png";
tileData.title = "Flip Tile Title";
tileData.wideBackBackgroundImage = "http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-03-metablogapi/5775.WideTileAfter_5F00_49305C14.jpg";
tileData.wideBackContent = "Wide Back Content";
tileData.wideBackgroundImage = "Assets/Tiles/FlipCycleTileLarge.png";
tileData.count = 3;
// now update the tile
Tiles.createOrUpdateSecondaryLiveTile( "flippy-tile", tileData );
}
if( GUILayout.Button( "Create Live Tile (Iconic)" ) )
{
// first, create the tile data
var tileData = new IconicTileData();
tileData.iconImage = "http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Breastfeeding-icon-med.svg/202px-Breastfeeding-icon-med.svg.png";
tileData.backgroundColor = Prime31.WinPhoneEssentials.Color.colorFromARGB( 255, 40, 255, 40 );
tileData.smallIconImage = "http://cdn.memegenerator.net/instances/250x250/38333070.jpg";
tileData.wideContent1 = "Wide content 1";
tileData.wideContent2 = "Wide content 2";
tileData.wideContent3 = "Wide content 3";
tileData.title = "Live Tile Title";
tileData.count = 3;
// now update the tile
Tiles.createOrUpdateSecondaryLiveTile( "my-tile", tileData );
}