iPhone SDK building an Omnigraffle like app - ios4

I have been trying to find an example or some hints on how to create an app that I could drag, resize, rotate images onto a UIView and then save the individual pieces (including their size, rotation and placement) and the entire UIView into CoreData. Kind of like the omnigraffle app.
Any tutorials, examples or anything on any piece of the app would be greatly appreciated.

for dragging a view
http://www.cocoacontrols.com/platforms/ios/controls/tkdragview
for roting a view http://www.cocoacontrols.com/platforms/ios/controls/ktonefingerrotationgesturerecognizer
for resizing a view
http://www.cocoacontrols.com/platforms/ios/controls/spuserresizableview
What respects to core data, its actually pretty straightforward just, gather the classes in one view, see the properties you need to save, and the new one you will need for your app and thats it.
Like:
Object Canvas containing a many relationship to morphlingViews wich contain all the properties as center, color, width, height, angle, UIPath (if you plan to create custom shapes) layer position (so it gets drawn correctly) and if you plan to connect the views as omnigraffle add a many realtionship to self (in morphlingViews) so you can take the center of different morphlingViews and add a simple line between them. (and a string if you plan to add drawInRect method to allow users to write in the objects, then it will be a good idea to add the text properties as well).
You can also add Quartz Composer drawing styles properties to the object, as shadow, shadowColor, shadowOffset, or add patterColor to add resizable background.

Related

Is it possible to draw a feature on a MapContent object (layer) in Geotools at runtime?

I am working on Geotools and trying to edit an existing layer at run time.
Basically I have a layer which I have added on to a MapContent object, which I then project it on JFrame. Now what I want to know is that can we manually draw some features on this showing on JFrame to edit this layer by drawing some features( which could be either a point or a polygon).
Yes, that is perfectly possible. You will need a Swing tool to handle the drawing and then some way to add any needed attributes to the geometry to make a new feature (see SimpleFeatureBuilder) and then add that to the layer.

How can I properly load a different Activity layouts based on screen size with Mvx?

I'm developing an Xamarin Android Mvx5-beta application. When running on a small-screen device, I want to show a drawer navigation using the Toolbar and the hamburger-icon. On larger devices, e.g. tablets, I want a different layout conaining three columns. No drawer navigation but a static panel with navigation options and two other panels for content.
I started with the examples XPlatformMenus and Fragments to get a drawer navigation layout combined with the use of activities (with fragments) in different layouts qualifiers, like:
Question:
Using this approach, Android automaticly looks for an activity with the same name (e.g. main_activity.axml) in the appropriate layout-qualifier folders. But on the larger screens I don't need a drawer layout and I do need an extra column. The Mvx-viewmodel does not yet know what layout to render, so it just calls:
ShowViewModel<HomeViewModel>();
ShowViewModel<MenuViewModel>();
These ViewModels, for example MenuViewModel, are registered for fragments that require a navigation_frame, as shown in here:
[MvxFragment(typeof(MainViewModel), Resource.Id.navigation_frame)]
[Register("mydemoapp.droid.views.fragments.MenuFragment")]
public class MenuFragment : MvxFragment<MenuViewModel>, NavigationView.IOnNavigationItemSelectedListener
{
<..>
}
So, rendering this same Activity in layout-sw600dp requires a navigation_frame. Which I don't want on these larger displays.
What would be the preferred design choise in this situation? I can think of two:
Show/hide elements in the Activity programmatically by querying the screen info
Don't make use of layout qualifiers, but design complete seperate Activities for larger screens and based on screen size let MVX Show ViewModel-A or ViewModel-B.
Any advice would be appreciated, many thanks in advance.
I think it depends how different your layout need to be between large screen and small screen form factors.
Few UI differences
In addition to using different layouts, you can define a bool property in your XML values resources that is different between standard and sw-600dp
values
<bool name="is_large_screen">false</bool>
values-sw600dp
<bool name="is_large_screen">true</bool>
You can then read this value in your Android views and prevent methods like ShowViewModel<MenuViewModel>(); firing when on large screens by altering the method calls from the view.
Many differences/Structural differences
If they share the same business logic but have very different UI requirements and you want to keep large screen code separate. Then I would suggest sharing the ViewModels but creating two separate Activites and layouts to handle the UI presentation. Using this method requires a bit more setup as you have to override some default MvvmCross behaviors as by default you can not register multiple Activities/Fragments to the same ViewModel. Overriding the MvxViewModelViewTypeFinder view lookup FindTypeOrNull you can intercept the lookup and filter types base on naming conventions. For example all large screen views end with "Tablet". Using the is_large_screen bool you can flag which views to register.

Questions about Citymaps

1、I want to create a circle and set an image that customized to fill the circle,use this as a marker on the map, not only could change the image but also the color of circle anytime,what can I do to implements this function? Please look at the picture below!
2、Like your CityMaps app show,when I enlarge the map, some business icon that hide are show on the map,which are hide again while shrink the map, How to achieve this effect?
3、After I initialization the Object Marker and called the method marker.setFadeTime(3000),the software give my tips the method is no exist and I see the class Marker.java but really not find the method,Why is it so?
4、I want to add some stars beside the marker like this:
What can I do to add the stars?the label only can set the text beside the marker.
5、I want to load your maps at the fragment,not the activity that extends FragmentActivity,I found the SupportCitymapsMapFragment is no use,What I can do to complete this requirement?
6、In your apps,it is locate that place after input New York in the search box,What can i do to complete this function whatever i input?
7、During I develop the apps about the Citymaps,I found a serious problem so that your apps had happend too. When I run the apps, the program force flash back all of a sudden and I run your apps Citymaps at this time,the problems are same of the front,I found some error in logical view that is follows:15327-15374/com.map.maplbs A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 15374 (Thread-1819).
To solve the problem,I must restart my device. Why is it so?
I am a developer on the Citymaps SDK, I will do my best to answer your questions.
1) I recommend using the Android Canvas API to construct the images, and then use a Marker to display it on the map. See the documentation for details: http://developer.citymaps.com/markers
2) This is built into the Citymaps BusinessLayer. This functionality is not exposed through an API. If you wish to use the Citymaps BusinessLayer, you should create a CitymapsMapView or CitymapsMapFragment/SupportCitymapsMapFragment and it will automatically be added to your map.
3) At this time, there appears to be a known issue with the fadeTime API. Thank you for bringing this to our attention. We will fix it in an upcoming release. For now, you can animate the alpha property of the Marker.
4) Once again, the functionality of the BusinessLayer is not directly exposed. If you wish to create similar markers, I recommend you construct the image using Android's Canvas and then adding it as a Marker to the map.
5) If you wish to load the map inside of a fragment, you can accomplish this using child fragments (check Android documentation for more details). You can also accomplish this by instantiating CitymapsMapView or MapView directly and adding it to your view hierarchy either in XML or in code. However if you do this, remember to call the lifecycle methods on your map instance, or else the map will not behave properly.
6) If you wish to have a search in your app, it is up to you to implement this feature. We do not currently provide a search API out of the box.
7) Thank you for the bug report. We will investigate this issue and fix it in a future release.
If you have any more questions, feel free to ask, and thank you for using the Citymaps SDK.

JavaFX-8: Custom Layout and Layout Passes (layout pass/css pass): Where should I add child nodes?

I'm developing a custom table component for very large and very custom content. Therefore I decided not to go with TableView, but start from scratch (i.e. Control). I adopted the idea of the VirtualFlow to create and manage only the visible part of the table and reuse cells that have become invisible. However I needed virtual rows and columns.
My CustomVirtualFlow implements layoutChildren(). From the component's size and scrollbar positions I know which cells are visible. If necessary, I add cells to the VirtualFlow. I then update the content and css pseudo class states (selected, focused, ...).
This works almost fine ... currently, my only problem is that the css styles are sometimes lagging: newly created cells are shown with e.g. wrong backgrounds for a moment and then get correcteted with the next pulse.
My explanation for this is that JavaFX performs layout in two passes:
first a css pass and secondly the layout pass that calls layoutChildren().
The css of newly added children (during layoutChildren) is therefore not processes correctly.
I tried to call applyCss() directly, which helps, but seems to do too much because it takes a lot of time.
My question is:
How is the correct way to add nodes during layout, i.e. if the size of the component makes it neccessary to use further nodes?
If it is not during layoutChildren(), where else should I do it?

JavaFX 2 change layout dynamically at runtime?

Swing had LayoutManager's separate from the containers. So far as I can tell, JavaFX doesn't do that.
I have a complex structure of nodes that I want the user to be able to toggle between several different layout approaches. Something equivalent to the user specifying flow and all containers are converted to the equivalent of FlowPanes. Then they could choose vertical and everything is laid out vertically.
Is there a way to do this other than swapping out the nodes/recreating the whole structure?
I should note: the hierarchy changes at runtime and it is deeply nested.
I mention Swing because this is straightforward to do in Swing by maintaining a list of all containers in the entire hierarchy, and with a simple loop (or tree traversal without the list) setting a new LayoutManager on them. JavaFX doesn't seem to have this possibility because the layout behavior appears to be internal to the nodes.
Isn't something like this working ?
AnchorPane main=new AnchorPane();
AnchorPane sub1=new AnchorPane();
sub1.getChildren().add(btn);
main.getChildren().add(sub1);
When you want to switch the layout
AnchorPane sub2=new AnchorPane();
main.getChildren().remove(sub1);
main.getChildren().add(sub2);
Edit
I guess I missed how you are doing layouts. This is how I envisioned it.
Definitions to Various Components
MainLayout
-> CustomLayout 1
-> References to various components. ( Essentially you are not creating all the components for every layout, rather you are referring to them in each layout )
-> CustomLayout 2
-> References to various components. ( More or less a different arrangement of the same components, adds some component references and removes some )
-> CustomLayout 3
-> References to various components.
Making a bold statement, but if there were a tool in JavaFX, how would it do this automatically ? Each template needs to know where it should render a particular component and arguably the easiest way to do this is just create a new template that arranges the components in a different layout and swap the template when user wants to see a different layout.
This is not easy to do in Swing. You would still need to set all the layout constraints on the individual components again, unless your layout is very straightforward.
I don't see how there is much difference in this between swing and javaFX. In JavaFX you would need to add the same controls to a different container (VBox, HBox etc.) but you still don't need to recreate the controls every time. It is a little awkward to find the containers in the middle of the node hierarchy but I'm sure there is some kind of elegant recursive solution :)

Resources