I am new in ArcGis. I came across a requirement that I need a command on the ArcGis Toolbar. On click the command, a Windows Form will open and there one region selector button is there. upon clicking on the button, the current Form UI must be minimized and the user will be allowed to draw a polygon. Can you please help on how to do that. Here is the code. I took normal windows button and wrote the below code in the click event.
_application = ((IApplication)_hookHelper.Hook);
IMxDocument pMxDoc = (IMxDocument)_application.Document;
IMap pMap = (IMap)pMxDoc.FocusMap;
IActiveView pActiveView = (IActiveView)pMap;
if (pActiveView == null)
{
return;
}
//// Changing the state of the Window.
if (this.WindowState == FormWindowState.Normal || this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Minimized;
// this.Hide();
}
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = pActiveView.ScreenDisplay;
// Constant
screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
rgbColor.Blue = 111;
ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast
ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberRectangularPolygonClass();
// ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberPolygonClass();
ESRI.ArcGIS.Geometry.IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolygon(geometry);
screenDisplay.FinishDrawing();
I am also not getting any mouse event and the UI is not minimized while starting drawing the polygon. Can anyone please help.
Have we check the white paper for ArcGIS runtime SDK for .Net?
http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Essential_vocabulary/01700000004z000000/
Related
Does anyone know whether it's possible, in Photoshop extend script, to convert an irregular selection (e.g. magic wand tool selection) into a rectangular selection encompassing the top, left, bottom and right bounds of the selection?
Here it is, I have documented the code so you can modify it later if you need. Also, check page 166 and following of Photoshop's JS reference manual, you may read more about selections - you can set feather, extend/intersect/etc. the selection if you need to.
Made for CS6, should work with latter.
#target photoshop
if (documents.length == 0) {
alert("nothing opened");
} else {
// start
//setup
var file = app.activeDocument;
var selec = file.selection;
//run
var bnds = selec.bounds; // get the bounds of current selection
var // save the particular pixel values
xLeft = bnds[0],
yTop = bnds[1],
xRight = bnds[2],
yBottom = bnds[3];
var newRect = [ [xLeft,yTop], [xLeft,yBottom], [xRight,yBottom], [xRight,yTop] ]; // set coords for selection, counter-clockwise
selec.deselect;
selec.select(newRect);
// end
}
Does anybody know how to move content of the page (maybe set relative margins or something like that) when soft keyboard is shown.
Here is the example page from my application.
So I want when the user starts typing a phone number in the text box the bottom button will be shown above the soft keyboard. As a result I want something like that:
P.S: Sorry about Russian language on the screens.
It's kind of tricky, but as I've tried should work. I've used InputPane's showing and hiding events to change the translate transform of the button. In page's constructor I've added such code:
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Showing += (s, args) =>
{
GeneralTransform gt = loginButton.TransformToVisual(this);
Point buttonPoint = gt.TransformPoint(new Point(0, loginButton.RenderSize.Height - 1));
var trans = new TranslateTransform { Y = -(buttonPoint.Y - args.OccludedRect.Top) };
loginButton.RenderTransform = trans;
args.EnsuredFocusedElementInView = true;
};
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Hiding += (s, args) =>
{
var trans = new TranslateTransform { Y = 0 };
loginButton.RenderTransform = trans;
args.EnsuredFocusedElementInView = false;
};
You only have to remember that InputPane is for the whole app - once you leave the page, you will probably have to unsubscribe from those events, otherwise you will likely get exceptions.
I am programmatically drawing a flowchart using Java UNO Runtime Reference in which I want to display grid Lines permanently.Using following code I was able to display the Grid Lines but they are toggled ON and OFF alternately when the code executes.
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xDrawDoc);
XController xController = xModel.getCurrentController();
XDispatchProvider xDisp = UnoRuntime.queryInterface(XDispatchProvider.class, xController);
XMultiComponentFactory xMCF = xContext.getServiceManager();
Object dispatchHelper = xMCF.createInstanceWithContext("com.sun.star.frame.DispatchHelper", xContext);
XDispatchHelper xDispatchHelper = UnoRuntime.queryInterface(XDispatchHelper.class, dispatchHelper);
PropertyValue[] navigatorDesc = new PropertyValue[1];
navigatorDesc[0] = new PropertyValue();
navigatorDesc[0].Name = "GridVisible";
navigatorDesc[0].Value = true;
xDispatchHelper.executeDispatch(xDisp, ".uno:GridVisible" , "", 0, navigatorDesc);
I want to permanently show Grid Lines.How can I achieve this using Java.Pls suggest. If there is any way of checking whether the Grid Lines are ON(any method which could return a boolean value), this could also be a useful approach.
Hi I am trying to create a context menu in windows 8 using Popup. On Right click of a button I am calling the following function
private async void UIElement_OnRightTapped(object sender, RightTappedRoutedEventArgs e)
{
PopupMenu popUpMenu = new PopupMenu();
popUpMenu.Commands.Add(new UICommand("File"));
Rect rect = GetRect(sender);
var result= await popUpMenu.ShowForSelectionAsync(rect, Placement.Right);
}
While defination for GetRect method is as follows:-
private Rect GetRect(object sender)
{
FrameworkElement element = sender as FrameworkElement;
GeneralTransform elementTransform = element.TransformToVisual(null);
Point point = elementTransform.TransformPoint(new Point());
Size size = new Size(element.ActualWidth, element.ActualHeight);
Rect rect = new Rect(point, size);
return rect;
}
Though the GetRect is returning correct value, but still i am getting result as null.
Please help
I can't figure out why you have this problems. On the first view, everything looks fine.
Maybe Tim Heuer Callisto package contains an easier approach for exactly what you want. See this example.
It's because you're not clicking on the File command, but instead clicking elsewhere on the page.
I am building an air app in Flex 4. I am creating windows as I need them in a chromeless application.
Here is what I have in my main app creation complete
protected function creationCompleteHandler(event:FlexEvent):void
{
facade.sendNotification(AppFacade.APP_INIT, this);
var buttons:NavigatorWindow = new NavigatorWindow();
var workingSets:WorkingSets = new WorkingSets();
buttons.addElement( workingSets );
buttons.width = 115;
buttons.height =200;
buttons.maximizable = false;
buttons.resizable = false;
buttons.addEventListener(AIREvent.WINDOW_COMPLETE, onWindowComplete);
buttons.open();
}
private function onWindowComplete(event:AIREvent):void
{
event.currentTarget.x = 100;
event.currentTarget.y = 100;
}
for some reason the application adds the window in the middle of the screen and if I set the x and y of the Window it does not put it where I expect in the upper left of my screen. How do I position the window where I would like when it is opened?
thanks,
The spark.components.Window exists inside a NativeWindow you'll need to position the NativeWindow if you want to move it around on the screen. It is a bit confusing because you can position the Window inside the native window as well. You'll have to do the positioning after creation complete, otherwise you'll get null reference errors.
You could invoke the window like this if you created a component based on spark.components.Window:
var win:MyWindow = new MyWindow(); //MXML component
win.height = 150;
win.width = 300;
win.systemChrome = NativeWindowSystemChrome.NONE;
win.type = NativeWindowType.LIGHTWEIGHT;
win.showStatusBar = false;
win.transparent = true;
win.alwaysInFront = true;
win.open(true);
Then in that mxml component, you set an creationComplete event handler to do this:
var padding:int = 25;
this.nativeWindow.x = Screen.mainScreen.visibleBounds.right - this.width - padding;
this.nativeWindow.y = Screen.mainScreen.visibleBounds.top + padding;
This should put your new window in the top right hand corner with 25px of padding on the top and right.