|
POST
|
Hi, I am trying to create a SearchCursor on a table which seems simple enough cursor = arcpy.SearchCursor(tablepath) This line of code though throws an error in _base.py: global name 'gp_' in not defined. I cannot seem to find any information on this error. I can create an UpdateCursor and an InsertCursor without error using the same tablepath variable. Is there something I am missing in this method call? I am using ArcGIS 10.0 Thanks -Joe
... View more
07-01-2012
02:20 AM
|
0
|
10
|
2702
|
|
POST
|
Hi Joe, 1. Now it is finally works. I wasn't aware of all these DataContext issues....I'm studing and programming at the same time so I miss things. I haven't tried the symbol yet but I'm sure it will work. Thanks a lot! Personally for me, understanding how DataContext works took a bit, it does open up a lot more in Silverlight once it makes sense 2. So sweet of you to write this code on action completion. The thing is that if there is so much code for it, I don't see the advantage of using it instead of QueryTask. Can you see any advantage? THe advantage and the nice thing about TriggerActions is it is a good way to separate business logic away from the UserControl code behind, really a design decision more than anything else 3. How do you know what is: Toda Raba? Falls in the things we learned before we were 13 category I guess.;). I spent one summer in your home back during high school and hope to visit again soon because I am working in the region right now 4. Do you have a tip/sample for wrapping DataGrid (or featureDataGrid) in a draggable/floatingWindow with close button? I saw some threads about it in the forum but couldn't find someting that attracted me. What I do is create a control that inherits from the DraggableWindow in the Template project and use that to implement that behavior. I find it a lot cleaner than trying to put everything in the MainPage. I actually have a sample of a FeatureDataGrid and FeatureDataForm integrated into a DraggableWindow I can post an example later Good Luck
... View more
06-30-2012
10:47 PM
|
0
|
0
|
1334
|
|
POST
|
Unfortunately in Silverlight you cannot set event handlers in Style (AFAIK).
... View more
06-30-2012
02:28 AM
|
0
|
0
|
559
|
|
POST
|
The FeatureDataGrid Xaml is in the FeatureDataGrid.Theme.xaml file of the toolkit
... View more
06-29-2012
08:01 PM
|
0
|
0
|
1214
|
|
POST
|
For this definition
Relationships:
Campus.DBO.SpeciesDomain (0) -- Related To: Campus.DBO.SpeciesDomain (1)
The RelationshipId = 0. The (1) after the second layer is the LayerId of the layer it is related to
... View more
06-29-2012
07:54 PM
|
0
|
0
|
887
|
|
POST
|
Looking at this some more I realize that the Action would not have a DataContext because it is not a FrameworkElement. So you would need to set the DataContext on something like the Button and use that to set the property on the Action So something like this in the XAML
<Button x:Name="QueryButton" Height="30" Width="30" Margin="0,0,2,0"
HorizontalContentAlignment="Left" Padding="2" Content="Query">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<Actions:SpatialQueryAction
DrawMode="Rectangle"
OutFields="FID,STATE_NAME,STATE_ABBR"
LayerID="MyQueryResultsGraphicsLayer"
Url="{Binding ElementName=QueryButton, Path=DataContext.Url}"
Symbol="{StaticResource GraphicsLayerFillSymbol}" QueryComplete="SpatialQueryAction_QueryComplete"
TargetName="Map" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
And in the code
public MainPage()
{
InitializeComponent();
ActiveLayer = new ActiveLayer { Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/2" };
QueryButton.DataContext = ActiveLayer;
}
public ActiveLayer ActiveLayer { get; set; }
private void SpatialQueryAction_QueryComplete(object sender, EventArgs e)
{
}
And because I seemingly have too much time on my hands, and I thought the idea useful I wrote a SpatialQueryAction that throws a QueryComplete event at the end, which I attached
... View more
06-29-2012
09:09 AM
|
0
|
0
|
1334
|
|
POST
|
I would post in the javascript forum http://forums.arcgis.com/forums/15-ArcGIS-API-for-JavaScript Good Luck
... View more
06-29-2012
07:16 AM
|
0
|
0
|
697
|
|
POST
|
I certainly don't think those changes could be done with styling, although I also cannot figure out Blend and not for lack of trying. I think the latter change would be pretty straight forward just change the visibility in the CommitButton_Click
private void CommitButton_Click(object sender, RoutedEventArgs e)
{
if (!this.IsReadOnly)
{
ApplyChanges();
this.Visibility = Visibility.Collapsed;
}
}
For your former need, there is a HasChange() method which seems to check if any change is made to know if the Commit button should enable, you could add an additional check in there to see if that particular field was changed. I have made custom versions of different tools myself, I think styling can only do so much. Of course, maybe that is just because I can not make heads nor tails out of Blend 🙂 Good Luck
... View more
06-28-2012
11:31 PM
|
0
|
0
|
389
|
|
POST
|
The info window seems to build everything up in code, not done through template styling. I ended up creating a MapTip to do a similar task for this reason. You can download the InfoWindow code off Codeplex http://esrisilverlight.codeplex.com/ and see where they are building up the border (BuildBorderPath method), you may be able to change for your needs and use a customized version Good Luck
... View more
06-28-2012
10:41 PM
|
0
|
0
|
395
|
|
POST
|
I admire your patience.... Thanks, Miri Toda Raba 🙂 In Silverlight the ah ha moment is when the data binding thing actually makes sense. The DataContext is pretty much a weakly typed object that any control can have attached to it. DataContext is inherited, so if I set the Context at the UserControl level everything shares that DataContext unless the control overrides it. This Xaml
<actions:SetLayerUrlAction Url="{Binding _ActiveLayer.URL}"/>
Is saying look at my DataContext (some object) for a (public) Property called _ActiveLayer and then attach to the Url property. But you have not defined this DataContext so it does not know what to look at. In the Button code it is saying the Map is DataContext and will look for a property on Map (which does not exist) So the DataContext of the page needs to be set so the Binding knows what it should look for (I am not sure if setting on the button works or if it needs to be the page)
public MainPage()
{
InitializeComponent();
DataContext = this;
}
in the class define your ActiveLayer object (public)
public ActiveLayer ActiveLayer { get; set; }
Now the MainPage UserControl is bound to the class MainPage class and so
<actions:SetLayerUrlAction Url="{Binding ActiveLayer.URL}"/>
Knows to look at the ActiveLayer property. Likewise you could set the DataContext to the ActiveLayer object itself, and then your binding is just to the properties on the ActiveLayer. This would be a more common approach because you would normally bind to the object that is raising the PropertyChanged events
public MainPage()
{
InitializeComponent();
ActiveLayer = new ActiveLayer();
DataContext = ActiveLayer ;
}
public ActiveLayer ActiveLayer { get; set; }
<actions:SetLayerUrlAction Url="{Binding URL}"/>
In a statement like {Binding ElementName=MyMap, Path=Layers[MyLayer]} it is setting the DataContext local to that Binding to the specific element. Good Luck
... View more
06-28-2012
06:40 AM
|
0
|
0
|
1334
|
|
POST
|
txtBuffer.Text is a string you need to pass a double to the method, that is why the error says you are passing a string where a double is required.
double distancebuffer = double.Parse(txtbuffer.Text);
bufferParams.Distances.Add(distancebuffer);
(perhaps at some point you could thank someone on this forum who offers you help)
... View more
06-28-2012
02:16 AM
|
0
|
0
|
682
|
|
POST
|
I guess the follow-up question is where/how are you setting the DataContext of your Control?
... View more
06-27-2012
09:28 PM
|
0
|
0
|
1911
|
|
POST
|
The toolkit is an open source project available on codeplex, took this out of the style for the AttchmentEditor and commented out the button. Placed it in the resources section of my control that has the AttachmentEditor
<ControlTemplate x:Name="NoButtonTemplate" TargetType="esri:AttachmentEditor">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="BusyStates">
<VisualState x:Name="Loaded">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ProgressIndicator">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Busy">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ProgressIndicator">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0:0:0.75" RepeatBehavior="Forever" To="360" Storyboard.TargetName="ProgressIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid x:Name="ProgressIndicator" Background="Transparent" Grid.Row="0" Grid.Column="0" Margin="3,0"
Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<RotateTransform />
</Grid.RenderTransform>
<Ellipse Fill="#1E525252" Margin="11,2,11,20" Width="2" Height="2"/>
<Ellipse Fill="#3F525252" Height="3" Width="3" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,4,5,0" />
<Ellipse Fill="#7F525252" Width="4" HorizontalAlignment="Right" Height="4" VerticalAlignment="Top" Margin="0,9,1,0" />
<Ellipse Fill="#BF525252" Height="5" Width="5" VerticalAlignment="Bottom" Margin="0,0,3,3" HorizontalAlignment="Right" />
<Ellipse Fill="#FF525252" Height="6" Width="6" VerticalAlignment="Bottom" Margin="9,0" />
</Grid>
<!--<Button x:Name="AddNewButton" Content="Add" HorizontalAlignment="Right"
Margin="3" Padding="3" MinWidth="50" Grid.Row="0" Grid.Column="1" IsEnabled="False" />-->
<ScrollViewer Grid.Row="1" Margin="3,0,3,3" Grid.ColumnSpan="2">
<ItemsControl x:Name="AttachmentList" ItemTemplate="{TemplateBinding ItemTemplate}"/>
</ScrollViewer>
</Grid>
</Border>
</ControlTemplate>
Added this code into the constructor of my control that has the AttachmentEditor on it.
InitializeComponent();
ControlTemplate ct = this.Resources["NoButtonTemplate"] as ControlTemplate;
if ( ct == null ) return;
AttachEditor.Template = ct;
No more button! 🙂 Good luck
... View more
06-27-2012
09:22 PM
|
0
|
0
|
701
|
|
POST
|
It's pretty hard to say without understanding how the DataContext is being set. but are you implementing the INotifyPropertyChanged in your _activeLayer object? This is required to notify the object bound in Xaml that something changed in the bound object. As for the symbol, if you have a Url being bound you could also bind a Symbol.
Symbol="{Binding _activeLayer.Symbol}"
When you set the Url you know the type of layer it is (point, line, polygon) and can set the appropriate symbol type at that time.
... View more
06-26-2012
10:40 PM
|
0
|
0
|
1911
|
|
POST
|
I would just remove the graphic itself (Graphics.Remove) from the Graphics collection, hold onto it and then add it back when needed
... View more
06-26-2012
09:48 PM
|
0
|
0
|
898
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | 10-23-2025 12:16 PM | |
| 1 | 10-19-2022 01:08 PM | |
| 1 | 09-03-2025 09:25 AM | |
| 1 | 04-16-2025 12:37 PM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|