|
POST
|
Yes, but's not something that you do specifically. It's just how it works. When you reference an assembly in your project and then compile it, the resulting assembly is dependent on the specific version of the dependent assembly. When you deploy your assembly, it will look for that specific version of the dependent assembly. If it cannot find it, then you'll get a runtime exception regardless of the fact that there may be other versions of that same assembly available and/or loaded. This is how Microsoft solved the "dll hell" problem of old. You can now have any number of versions on the same machine and each application will use the version under which it was compiled (assuming the dependent assembly is located in one of the places the runtime will look for it). "Version", of course, is defined as having an actual version number that changes with each release of the assembly (as opposed to just changing some code and recompiling it). It does, however, present a different issue. Applications that are currently deployed cannot use a newer version of a dependent assembly without first recompiling the application against the new version of the dependency and redeploying it. There is a way around this by registering your dependent assemblies in the GAC and using publisher policy assemblies to redirect calls to the older version to the newer version. Doing this defeats the purpose of creating ArcGIS Addins though as the one of the reasons to do this is to not require admin privileges in order to perform the install.
... View more
02-06-2014
10:16 AM
|
0
|
0
|
2274
|
|
POST
|
Are you setting the version number on the dependent assembly when you compile it? If you are, then you shouldn't be having any problems. The .NET runtime resolves dependencies by looking in several places, one of which is the directory where the calling assembly is located. If you put your dependent assembly there, then it should have no problem finding it and loading it.
... View more
02-06-2014
09:22 AM
|
0
|
0
|
2274
|
|
POST
|
Use IElementProperties to assign a name to the element when it is created. When you go to delete the element, loop through the graphics container looking for an element with that name. If you don't find it, it has already been deleted.
... View more
01-31-2014
04:00 AM
|
0
|
0
|
1062
|
|
POST
|
I don't know the answer to that. I would start by releasing them all to see if it fixes your problem. If it does, and you decide you really don't want all those release calls then you can remove them one by one to see which are necessary and which aren't.
... View more
01-29-2014
10:25 AM
|
0
|
0
|
1453
|
|
POST
|
Technically you should be assigning a spatial reference to your geometries so that the linear units are defined. That spatial reference will also define the precision. It's better to get a more precision result. Up to a certain point, yes this is true. However, I'm assuming your linear units are feet or meters since these are quite common. If that's the case then the results are accurate out to about a millionth of a foot or meter. You'd need an electron microscope to see that so does it really matter?
... View more
01-29-2014
10:15 AM
|
0
|
0
|
1275
|
|
POST
|
You might need to release the COM objects you're using. You can do that via Marshal.ReleaseComObject.
... View more
01-29-2014
10:01 AM
|
0
|
0
|
1453
|
|
POST
|
What product is your application binding to before checking out a license? The IExportOperation interface is only available with ArcGIS Desktop so unless you're binding to Desktop you won't be able to use it.
... View more
01-29-2014
09:58 AM
|
0
|
0
|
768
|
|
POST
|
Take a look at the IHitTest interface. It can tell you if a point is on the line as well as the segment index of the segment in the line's segment collection. If the line is multi-part, it will also tell you the part index in the line's geometry collection.
... View more
01-29-2014
06:47 AM
|
0
|
0
|
2350
|
|
POST
|
Never use New to create an instance of a singleton object like a workspace factory. Always use the Activator class. Also, is this a standalone application? If so, are you binding to a product then checking out a license before running this code?
... View more
01-23-2014
04:24 AM
|
0
|
0
|
1761
|
|
POST
|
I read the quote as the model is able to change the state of the view, through the controller, usually. And what about not usually? Can the model change the state of the view? Yes. Should it? I don't know. Probably not, at least not directly. Having the model directly change the state of the view assumes that the model knows something about the view. Since multiple views can be created for the same model, allowing the model to change the view would potentially create conflicts where the model was attempting to change something that a particular view doesn't support. For example, let's say our model is a class named Employee that represents a record from the Employees table in our database. Our Employee class has a property named DateOfBirth that represents the column of the same name in the database table. We have a view that allows the user to edit the record for an existing employee. We have another view that displays a list of current employees. This list displays various information about the employee including their age. Since age isn't a value that is stored in the employees table it must be calculated from the DateOfBirth property. To keep things up to date, we would want the age of an employee displayed in the list to automatically update if the record for that employee is edited and the DateOfBirth is changed. One way to accomplish this is to have the model update the employee list whenever the DateOfBirth property value changes. This can lead to problems. What if the view isn't open? What if the model is being used in an application that doesn't have that view? A better way to handle this would be to create a DataOfBirthUpdated event that a controller class could subscribe to. The model fires the event when the property changes and any listeners can respond in whatever manner is appropriate. In this case, the controller calculates the new age and updates the list in the view. There are other solutions as well, but it would seem to me that having the model directly interact with the view is the least preferred. Alot of times before you call model methods, you want to do some pre-model logic with the view, enabling or disabling a button, resetting sliders to their default positions, etc. To me, this isn't business logic. That's GUI logic. The GUI is responsible for gathering input, validating input, leading the user through the correct workflow, etc. Keeping with the Employee model example, let's say we have a view for creating a new Employee. The view will prompt the user for relevant input such as name, date of birth, job title, salary, etc. Pretty much everything the user is entering should have a corresponding property on the Employee class. As the user enters it in, the view passes it to the controller which sets the property on it's internal instance of the Employee class. When the user is done, they click a button which calls the controller and tells it to create the new record, which it does by calling a method on the Employee class. For the most part, the view can perform any validation checks before passing the data along. In some instances you may want the Employee class to do that. Typically this would be when there is some type of business rule in place. Maybe a particular job title has a minimum salary. In this case, the model would perform the check and throw an exception if the rule isn't satisfied. The controller would catch the exception and handle it. Other types of validation, such as making sure the user enters the date of birth in a valid Date format would typically be handled directly by the view. As I said in my first post, the examples I've looked at on the web are quite varied in their approach. I don't think there's any "right" way as long as what you choose to do meets your requirements, is easy to understand and is easy to come back to and change in 6 months!
... View more
01-22-2014
12:03 PM
|
0
|
0
|
1350
|
|
POST
|
I don't profess to be any kind of expert with this particular design pattern and it seems that no two examples I've ever looked at were the same. From what I can gather, the underlying purpose of MVC is to separate the GUI from the business logic. The view knows nothing about the model and the model knows nothing about the view. In your example, you're passing a reference to the view into the model. To me, this seems to break the pattern. Your model class is now dependent on the view being a Windows Form class. What if you wanted to create a view in a web application based on this model? We implement this pattern in several of our applications, a couple of which have both desktop and web versions. When I say implement, I mean that we follow the idea of MVC to some degree but some may argue that it's not true MVC. For example, we don't refer to models as "models". They are just typical classes that represent entities within the application (a Widget class for example). A typical scenario would be a form that creates a new widget and saves it into the database. The form gets a reference to a controller class and, as the user inputs values into the controls on the form, methods are called on the controller to pass the input (we don't use events as they seem to be cumbersome, confusing and unnecessary). The controller class creates a new instance of a Widget when it is initialized and sets the properties on the Widget as they are updated via the view. When the user finishes, they click a Save button on the dialog which calls a method on the controller to finish the deal. The controller in turn calls a method on the Widget class that saves the object into the database. Using this pattern, both our web and desktop versions can use the same Widget class which keeps the business logic common. They, of course, need their own view and controller classes but once you create them for one it's a relatively simple process to copy it to the other. Anyway, that's my two cents. I'm always interested to see how other programmers do things.
... View more
01-22-2014
04:38 AM
|
0
|
0
|
1350
|
|
POST
|
Sounds like you're opening a modal form when you want to be opening an modeless form. In .NET, you call Show() instead of ShowDialog() to do that.
... View more
01-17-2014
04:02 AM
|
0
|
0
|
880
|
|
POST
|
An envelope isn't what you really need to use if you want to only select features within a certain distance from a point. Instead, use ITopologicalOperator.Buffer to buffer the point, creating a true circle that you can use in your spatial query.
... View more
01-17-2014
03:57 AM
|
1
|
0
|
672
|
|
POST
|
hi, I am using .net frame work 4.0,ArcServer 10.0,sql server 2008. I want to get the cordinates(points) of a circular polyline so that i can store that in sql server . what is the best way to get these cordinates , curently i m using IPointCollection - this which give two point but both points are same as end point and start point are same. Thanks in Advance. What you're seeing is correct. The boundary of a true circle only has two points, the point where it begins and the point where it ends. Because it is a curve there are no points in between. Because it is a circle, the start point and end point have the same coordinates.
... View more
01-16-2014
10:11 AM
|
0
|
0
|
417
|
|
POST
|
I am creating an Add-in with ArcGIS 10.1 using MS Visual Studio 2010 VB.net I have a button on my toolbar that opens a form (frmFieldDescription) with a listbox (ListBox1) that is populated with a list of .lyrs from a directory (G:\PPACG\)......this works fine. PROBLEM: On the form I created another button (Button1_Click).....I've been trying to get this button to load the selected .lyr(s) from the listbox to be loaded onto ArcMap's View Document. Currently, with the code I have under (Button1_Click) works but it will it will only add the first .lyr For example, if I select four different layers it will only load the first selected layer (i.e. airports) four times into the ArcMap View Document. I tried using MsgBox(s.ToString, , "Oops") and it returns the correct four different layers. QUESTION: How can I iterate thru "s" to bring in the correct four different layers into ArcMap? See the code below for Button1_Click: Imports ESRI.ArcGIS.SystemUI Imports System.Windows.Forms Imports System Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.Framework Imports ESRI.ArcGIS.Carto Imports ESRI.ArcGIS.ArcMapUI Imports ESRI.ArcGIS.Catalog Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.DataSourcesFile Imports System.Windows.Forms.ListBox Public Class frmFieldDescription Private Sub frmFieldDescription_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim directoryInfo As IO.DirectoryInfo = New IO.DirectoryInfo("G:\PPACG\CADASTRAL_LYRS") If Not (directoryInfo Is Nothing) Then Dim fileInfo As IO.FileInfo() = directoryInfo.GetFiles Dim i As Int32 For i = 0 To fileInfo.GetUpperBound(0) ListBox1.Items.Add(fileInfo(i).FullName) 'JH Changeback to Name Next i End If End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click '''''''''''''''''''''''''''MsgBox(Mychoice.ToString, , "Oops") Dim pMxDoc As IMxDocument Dim pMap As IMap pMxDoc = My.ArcMap.Document pMap = pMxDoc.FocusMap Dim pGxFile As IGxFile Dim pGxLayer As IGxLayer pGxLayer = New GxLayer pGxFile = pGxLayer Dim itemList As New List(Of String) 'Dim Mychoice As Integer For Each s As String In ListBox1.SelectedItems itemList.Add(s) '''''itemlist does not have need return "s" does return the correct string ''''' MsgBox(s.ToString, , "Oops") pGxFile.Path = s pMap.AddLayer(pGxLayer.Layer) Next ' Dim itemArr() As String = itemList.ToArray 'For Each s As String In itemArr 'pGxFile.Path = s ' pMap.AddLayer(pGxLayer.Layer) '''''''''''''''''''''''' System.Windows.Forms.MessageBox.Show(s) 'Next End Sub End Class I would suggest using ILayerFile to open the layer file. You're code is using an older and less intuitive method of working with layer files that was necessary before ILayerFile was added to the object model.
... View more
01-16-2014
04:15 AM
|
0
|
0
|
915
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-20-2014 05:29 AM | |
| 1 | 02-01-2011 04:18 AM | |
| 1 | 02-04-2011 04:15 AM | |
| 1 | 01-17-2014 03:57 AM | |
| 1 | 10-07-2010 07:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|