The WinRT API knows both Geopoint and GeoboundingBox classes. Is there an easy way to check if a Geopoint lies within a GeoboundingBox? This seems like an obvious thing to do but it seems this is something the framework does not support out of the box?
For a rectangle it might seem trivial, but its getting harder of the GeoshapeType is a Geocircle for example. Am I missing something here or do I need to start comparing long&lat values myself?
There is no built-in API from GeoboundingBox class that could directly check if a Geopoint lies in it. So yes, if you want to check whether the point is inside the GeoboundingBox, you might need to get the long&lat values from the NorthwestCorner property and SoutheastCorner property of GeoboundingBox first. Then compare them with the long&lat values of the target point.
Related
I need to change the layer mask during runtime in order to select different objects depending on the context.
From my understanding this should be done in the InputSystemProfile by editing the Pointers property:
CoreServices.InputSystem.InputSystemProfile.PointerProfile.PointingRaycastLayerMasks
But the field is read-only, and I can't find another way to edit it, other than manually in the editor.
Btw I'm using an editable profile for the input system.
In HTK this was achieved by assigning a value to:
GazeManager.Instance.RaycastLayerMasks
Any suggestions?
For the returned field PointingRaycastLayerMasks, it is an instance of reference type LayerMask[]. Therefore, although you cannot change the value of the reference itself, it is possible to change the data that belongs to that referenced object.
So, you can change Layer Mask with the following code:
//Uncheck [PostProcessing],[Spatial Awareness]
CoreServices.InputSystem.InputSystemProfile.PointerProfile.PointingRaycastLayerMasks[0].value = 19;
If you have questions about how to use LayerMasks in Unity, please see here: How do I use layermasks?
you could change the pointers layer mask by overriding it
All the pointers can by found here: CoreServices.InputSystem.DetectedInputSources
and in each one you can do:
ptr.PrioritizedLayerMasksOverride
Hope this helps
I'm trying to figure out how to access the filled regions created when an object is cut in plan or section. My aim is to write a tool that duplicates these regions in order to quickly create dual hatches in a view.
I'm unsure at the moment whether these regions are associated with the family instance itself, or the view, or the work plane, etc.I've poured through Revit Lookup but can't locate it.
There is some information here about creating new filled regions through
FilledRegion.Create(...)
But I'm more interested in accessing the ones already created in a view.
Any suggestions would be much appreciated.
The code snippet below would return Elements of all the FilledRegions of the current Document (doc) in a specified View (v). I hope that gets you going in the right direction.
FilteredElementCollector collector = FilteredElementCollector(doc,v.Id).OfClass(typeof(FilledRegion));
Sorry, I misunderstood what you were looking for.
You can get the CutPatternId of a Material, which would return the pattern you see when an element is cut. I don't have a code snippet for you, but, what you'd want is:
User selects the Element
API gets all the Materials of that Element
API returns all the CutPatternIds of those Materials
(FillPatternElement)
API returns all the FilledRegionType(s) with
the same FillPatternId (creating them is necessary)
API generates the FilledRegion using the correct FilledRegionType.
Item 5 is the trickiest part because I'm not sure how you could determine the boundary it's supposed to draw. #jeremy-tammik is super smart, and he's the author of the blog you referenced. Maybe he could fill in the gap on this part. Maybe there is something you could return from an "Intersect" method?
I know templates are common within c/c++ however I am currently trying to translate an old VB code our company uses up to a c# equivalent which brings me to my problem....
VB is an type unsafe language so we come across things like
Public Elements As New Collection
so given the line above I need to translate that to a List.. Given that a Collection can be anything from a List to a map I need to template this as efficiently as possible. I was thinking of for first draft ignoring the map option entirely and just making it a List however from my understanding Templates don't truly exist within C#... The below code is what I came up with so far and while it compiles (I have not gotten to a testing point in the rest of the code yet) I don't know if it would actually work...
Public List<ValueType> Elements = new List<ValueType>();
can anyone offer input on if this would work as a generic list where type is determined at input or if I need to change this so the constructor would look more like
Public List<ValueType> Elements = new List<typeof(foo)>();
if the above is confusing I am sorry it is for me as well, and I will try and clarify as questions come in.
this question is no longer relevant, I was able to go into the source of the calling code and determine what variable types that the lists need to support.
I am developing a windows store app that allows a User to place points on a map and load them from a server. I have this working fine but I need to include more properties than the standard Pushpin class allows (rating / description / user).
Because Pushpin is sealed, I cannot add these fields and use my own object in place of Pushpin. I tried over the past couple of hours to compose my own PointOfInterest class with a Pushpin object inside it however, this approach fails in a number of areas (When I place a point on a map, I want to retrieve more details than just name / tag and have no way of getting a reference back to the original object.)
If anybody has an idea of where to go from here I would like to hear from you !
If you need access to the private members of a sealed class then you are out of luck.
Best you can do is proxy (which you already seem to be doing by including it as a member). Also called faking it :)
I am working on a custom ArcGIS Desktop tool project and I would like to implement an automated linear referencing feature in it. To make a long story short, I would like to display problematic segments along a route and show the severity by using a color code (say green, yellow, red, etc.). I know this is a pretty common scenario and have come to understand that the "right way" of accomplishing this task is to create a linear event table which will allow me to assign different codes to certain route segments. Some of my colleagues know how to do it manually but I can't seem to find any way to replicate this programaticaly.
The current tool is written in C# and already performs all the needed calculations to determine the problematic areas. The problem mainly is that I don't know where to start since I don't know a lot about ArcObjects. Any code sample or suggestion is welcome (C# is preferred but C++, VB and others will surely help me anyway).
EDIT :
I'm trying to use the MakeRouteEventLayer tool but can't seem to get the different pre-conditions met. The routes are hosted on an SDE server. So far, I am establishing a connection this way :
ESRI.ArcGIS.esriSystem.IPropertySet pConnectionProperties = new ESRI.ArcGIS.esriSystem.PropertySet();
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWorkspaceFactory;
ESRI.ArcGIS.Geodatabase.IWorkspace pWorkspace;
ESRI.ArcGIS.Location.ILocatorManager pLocatorManager;
ESRI.ArcGIS.Location.IDatabaseLocatorWorkspace pDatabaseLocatorWorkspace;
pConnectionProperties.SetProperty("server", "xxxx");
pConnectionProperties.SetProperty("instance", "yyyy");
pConnectionProperties.SetProperty("database", "zzzz");
pConnectionProperties.SetProperty("AUTHENTICATION_MODE", "OSA");
pConnectionProperties.SetProperty("version", "dbo.DEFAULT");
pWorkspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactory();
pWorkspace = pWorkspaceFactory.Open(pConnectionProperties, 0);
pLocatorManager = new ESRI.ArcGIS.Location.LocatorManager();
pDatabaseLocatorWorkspace = (ESRI.ArcGIS.Location.IDatabaseLocatorWorkspace)pLocatorManager.GetLocatorWorkspace(pWorkspace);
Now I am stuck trying to prepare everything for MakeRouteEventLayer's constructor. I can't seem to find how i'm supposed to get the Feature Layer to pass as the Input Route Features. Also, I don't understand how to create an event table properly. I can't seem to find any exemple relating to what I am trying to accomplish aside from this one which I don't understand since it isn't documented/commented and the datatypes are not mentionned.
I'm not entirely certain what it is you want to do. If you want to get Linear Referencing values or manipulate them directly in a feature class that already has linear referencing defined, that's pretty straight forward.
IFeatureClass fc = ....;
IFeature feature = fc.GetFeature(...);
IMSegmentation3 seg = (IMSegmentation3)feature;
... blah ...
If you need to create a Feature class with linear referencing, you should start witht he "Geoprocessing" tools in the ArcToolbox. If the out-of-the-box tools can do most of what you need, this will minimize your coding.
I would strongly recommend trying to figure what you need to do with ArcMap if at all possible... then backing out the ArcObjects.
Linear Referencing API
Linear Referencing Toolbox
Understanding Linear Referencing