Search Results

Search found 2417 results on 97 pages for 'states'.

Page 4/97 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How should I smooth the transition between these two states in flex/flashbuilder

    - by Joshua
    I have an item in which has two states, best described as open and closed, and they look like this: and And what I'd like to do is is smooth the transition between one state and the other, effectively by interpolating between the two points in a smooth manner (sine) to move the footer/button-block and then fade in the pie chart. However this is apparently beyond me and after wrestling with my inability to do so for an hour+ I'm posting it here :D So my transition block looks as follows <s:transitions> <s:Transition id="TrayTrans" fromState="*" toState="*"> <s:Sequence> <s:Move duration="400" target="{footer}" interpolator="{Sine}"/> <s:Fade duration="300" targets="{body}"/> </s:Sequence> </s:Transition> <s:Transition> <s:Rotate duration="3000" /> </s:Transition> </s:transitions> where {body} refers to the pie chart and {footer} refers to the footer/button-block. However this doesn't work so I don't really know what to do... Additional information which may be beneficial: The body block is always of fixed height (perhaps of use for the Xby variables in some effects?). It needs to work in both directions. Oh and the Sine block is defined above in declarations just as <s:Sine id="Sine">. Additionally! How would I go about setting the pie chart to rotate continually using these transition blocks? (this would occur without the labels on) Or is that the wrong way to go about it as it's not a transition as such? The effect I'm after is one where the pie chart rotates slowly without labels prior to a selection of a button below, but on selection the rotation stops and labels appear... Thanks a lot in advance! And apologies on greyscale, but I can't really decide on a colour scheme. Any suggestions welcome.

    Read the article

  • Toggling between states on 3 containers in jQuery

    - by Saif Bechan
    Hello, i have an php/mysql/ajax auction application application. Now there is a section that can have 3 states. State one, the user can place a bid.(Bid button is shown) State two, the user has to wait before he can place a new bid(number of sec is shown) State three, the user has an auto bidding system enabled.(The price maximum and amount ate shown). Now i get these values trough jquery ajax, and i want to present the user the right section. Now the code i have is as follows: if(data[i].bidwait >= 0 && data[i].amount == ''){ // In this section the user has no autobiddings, and can place a bidding $(productContainer+' .bid-wrapper').removeClass('none'); $(productContainer+' .bidwait-wrapper').addClass('none'); $(productContainer+' .autobid-wrapper').addClass('none'); }else if(data[i].bidwait < 0 && data[i].amount == ''){ // In this section the user has to wait the amount of sec to place a new bid $(productContainer+' .bid-wrapper').addClass('none'); $(productContainer+' .bidwait-wrapper').removeClass('none'); $(productContainer+' .autobid-wrapper').addClass('none'); $(productContainer+' .bidwait-text').text(data[i].bidwait * -1); }else{ // In the last section the user has the auto bidder enabled, so that is shown $(productContainer+' .bid-wrapper').addClass('none'); $(productContainer+' .bidwait-wrapper').addClass('none'); $(productContainer+' .autobid-wrapper').removeClass('none'); $(productContainer+' .amount').html(data[i].amount == 0 ? '&#8734;' : data[i].amount); $(productContainer+' .maxprice').html(data[i].maxprice == 0 ? '&#8734;' : data[i].maxprice); } This looks like an awful lot of code for something so small. I was wondering if there is an easier method to accomplish such a thing. Speed is a huge issue for me because this has to run every second in the users browser. If there is no other option i am just going to remove this option and go with a no ajax approuch. If you have been, thank you for reading!

    Read the article

  • AsyncTask, inner classes and Buttons states

    - by Intern John Smith
    For a musical application (a sequencer), I have a few buttons static ArrayList<Button> Buttonlist = new ArrayList<Button>(); Buttonlist.add(0,(Button) findViewById(R.id.case_kick1)); Buttonlist.add(1,(Button) findViewById(R.id.case_kick2)); Buttonlist.add(2,(Button) findViewById(R.id.case_kick3)); Buttonlist.add(3,(Button) findViewById(R.id.case_kick4)); Buttonlist.add(4,(Button) findViewById(R.id.case_kick5)); Buttonlist.add(5,(Button) findViewById(R.id.case_kick6)); Buttonlist.add(6,(Button) findViewById(R.id.case_kick7)); Buttonlist.add(7,(Button) findViewById(R.id.case_kick8)); that I activate through onClickListeners with for example Buttonlist.get(0).setActivated(true); I played the activated sound via a loop and ifs : if (Buttonlist.get(k).isActivated()) {mSoundManager.playSound(1); Thread.sleep(250);} The app played fine but I couldn't access the play/pause button when it was playing : I searched and found out about AsyncTasks. I have a nested class PlayPause : class PlayPause extends AsyncTask<ArrayList<Button>,Integer,Void> in which I have this : protected Void doInBackground(ArrayList<Button>... params) { for(int k=0;k<8;k++) { boolean isPlayed = false; if (Buttonlist.get(k).isActivated()) { mSoundManager.playSound(1); isPlayed = true; try {Thread.sleep(250); } catch (InterruptedException e) {e.printStackTrace();}} if(!isPlayed){ try {Thread.sleep(250);} catch (InterruptedException e) {e.printStackTrace();} } } return null; } I launch it via Play.setOnClickListener(new PlayClickListener()); with PlayClickListener : public class PlayClickListener implements OnClickListener { private Tutorial acti; public PlayClickListener(){ super(); } @SuppressWarnings("unchecked") public void onClick(View v) { if(Tutorial.play==0){ Tutorial.play=1; Tutorial.Play.setBackgroundResource(R.drawable.action_down); acti = new Tutorial(); Tutorial.PlayPause myPlayPause = acti.new PlayPause(); myLecture.execute(Tutorial.Buttonlist); } else { Tutorial.play=0; Tutorial.lecture.cancel(true); Tutorial.Play.setBackgroundResource(R.drawable.action); } } } But it doesn't work. when I click on buttons and I touch Play/Pause, I have this : 07-02 11:06:01.350: E/AndroidRuntime(7883): FATAL EXCEPTION: AsyncTask #1 07-02 11:06:01.350: E/AndroidRuntime(7883): Caused by: java.lang.NullPointerException 07-02 11:06:01.350: E/AndroidRuntime(7883): at com.Tutorial.Tutorial$PlayPause.doInBackground(Tutorial.java:603) 07-02 11:06:01.350: E/AndroidRuntime(7883): at com.Tutorial.Tutorial$PlayPause.doInBackground(Tutorial.java:1) And I don't know how to get rid of this error. Obviously, the Asynctask doesn't find the Buttonlist activated status, even if the list is static. I don't know how to access these buttons' states, isPressed doesn't work either. Thanks for reading and helping me !

    Read the article

  • Any store/website selling Ubuntu-branded merchandise within United States?

    - by MIH1406
    I checked two websites about Ubuntu-branded merchandise but they charge too much for the products and for the shipping. I think because they are not within United States and the shipping is classified as International shipping. Any idea about stores or websites that are local to United States? I tried amazon but I could not find the same items. These what I had already checked: http://shop.canonical.com/ http://www.unixstickers.com/

    Read the article

  • Netstat shows numerous CLOSE_WAIT states for mysql connections

    - by Sudheer
    The output of netstat -an shows many mysql connections in CLOSE_WAIT state and when i checked the processlist in mysql using 'SHOW PROCESSLIST' the connections shown in netstat do not appear. What possible could be the reason for this. I use tomcat with mysql-connector and use a Connection Pool as well. Is it that the application is not closing the mysql connection or is there any other reason for this behaviour... sometimes the CLOSE_WAIT reaches over 200. On the application level i made sure that i close all the connections(make sure i issue a close() command in the finally block) created using jdbc. Any help would be appreciated.

    Read the article

  • merge() multiple data frames (do.call ?)

    - by Vincent
    Hi everyone, here's my very simple question: merge() only takes two data frames as input. I need to merge a series of data frames from a list, using the same keys for every merge operation. Given a list named "test", I want to do something like: do.call("merge", test). I could write some kind of loop, but I'm wondering if there's a standard or built-in way to do this more efficiently. Any advice is appreciated. Thanks! Here's a subset of the dataset in dput format (note that merging on country is trivial in this case, but that there are more countries in the original data): test <- list(structure(list(country = c("United States", "United States", "United States", "United States", "United States"), NY.GNS.ICTR.GN.ZS = c(13.5054687, 14.7608697, 14.1115876, 13.3389063, 12.9048351), year = c(2007, 2006, 2005, 2004, 2003)), .Names = c("country", "NY.GNS.ICTR.GN.ZS", "year"), row.names = c(NA, 5L), class = "data.frame"), structure(list( country = c("United States", "United States", "United States", "United States", "United States"), NE.TRD.GNFS.ZS = c(29.3459277, 28.352838, 26.9861939, 25.6231246, 23.6615328), year = c(2007, 2006, 2005, 2004, 2003)), .Names = c("country", "NE.TRD.GNFS.ZS", "year"), row.names = c(NA, 5L), class = "data.frame"), structure(list( country = c("United States", "United States", "United States", "United States", "United States"), NY.GDP.MKTP.CD = c(1.37416e+13, 1.31165e+13, 1.23641e+13, 1.16309e+13, 1.0908e+13), year = c(2007, 2006, 2005, 2004, 2003)), .Names = c("country", "NY.GDP.MKTP.CD", "year"), row.names = c(NA, 5L), class = "data.frame"))

    Read the article

  • Error Log states that I have MySQL connect error, yet script runs fine

    - by rob - not a robber
    Hello All, First, thanks for all the help I've received so far from StackOverflow. I've learned much. Once again, I'm posing a rudimentary question that I've searched on, but cannot find the exact answer to. Here or on PHP.net. It's sort of like what this guy asked, but not exactly: http://stackoverflow.com/questions/288603/mysql-throwing-query-error-yet-finishing-query-just-fine-why So, I saw my errorlog ballooning up when I checked my site directory and opened to notice that a bunch of errors have been recorded since I wrote this new Admin area. I know something is obviously awry with my scripting for the error to be thrown, but the weird thing is, the script actually runs through and pulls all the data I need without breaking. The log contains: PHP Warning: mysql_query() [function.mysql-query]: Access denied for user 'someuser'@'localhost' (using password: NO) in /home/mysite/adminconsole.php on line 15 I don't get that because that very line is where I setup my connection... the exact same way I do it everywhere else on the site with no problem. After that error, I have these thrown at the same time [09-Apr-2010 08:44:18] PHP Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/mysite/adminconsole.php on line 15 [09-Apr-2010 08:44:18] PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mysite/adminconsole.php on line 16 From what I read in the other guys thread, the problem is the contents of the query maybe? Maybe my query is malformed? Thanks so much for any guidance you can provide. -Rob

    Read the article

  • How do I resolve the config error which states a machine to application error

    - by waterfalrain
    I imported a website made in visual studio express 2008 to visual studio express 2010. When I run the home page I get the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." When I looked up the meaning of this on Google I read their needed to be a change to the configuration of the virtual directory. Another suggestion was to change the web config files . T Were these suggestions correct? If so how do I emplement them so that I can view these website pages on my local machine.

    Read the article

  • Passing data between states PHP

    - by esryl
    So I am using Limonade PHP which has a RESTful design which emulates PUT, POST, DELETE routes for create, update, delete. I am trying to develop some form validation which is going well. The major problem I am facing though is how to return my filtered data (which has failed validation) back to repopulate the create or edit form. How would this be done? I currently have for creating a page: /admin/page/new -> GET function /admin/page -> POST function + validate + pass, update db + fail, add errors to flash, redirect to /admin/page/mew It all falls down as I do not know how to populate the /admin/page/new with the invalid, but filtered data.

    Read the article

  • Flash FLVPlayback states

    - by rob5408
    I'm writing my own class to manage a skin for an FLVPlayback component. It works 90% of the time, but sometimes the state get really messed up. Specifically, the video is playing, meaning I can see it play and the VideoEvent.PLAYHEAD_UPDATE event is firing, but when I poll the FLVPlayback component about its playing property, it returns false. I assume this may be because 'buffering' is kind of a subset of 'playing', but I cannot confirm this in the documentation. I guess another way to ask this question is, "Does the FLVPlayback component ever buffer while it is in a stopped state?"

    Read the article

  • Android: changing drawable states of option menu items seems to have side-effects

    - by pjv
    In my onCreateOptionsMenu() I have basically the following: public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, MENU_ITEM_INSERT, Menu.NONE, R.string.item_menu_insert).setShortcut('3', 'a').setIcon(android.R.drawable.ic_menu_add); PackageManager pm = getPackageManager(); if(pm.hasSystemFeature(PackageManager.FEATURE_CAMERA) && pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)){ menu.add(Menu.NONE, MENU_ITEM_SCAN_ADD, Menu.NONE, ((Collectionista.DEBUG)?"DEBUG Scan and add item":getString(R.string.item_menu_scan_add))).setShortcut('4', 'a').setIcon(android.R.drawable.ic_menu_add); } ... } And in onPrepareOptionsMenu among others the following: final boolean scanAvailable = ScanIntent.isInstalled(this); final MusicCDItemScanAddTask task = new MusicCDItemScanAddTask(this); menu.findItem(MENU_ITEM_SCAN_ADD).setEnabled(scanAvailable && (tasks == null || !existsTask(task))); As you see, two options items have the same drawable set (android.R.drawable.ic_menu_add). Now, if in onPrepareOptionsMenu the second menu item gets disabled, its label and icon become gray, but also the icon of the first menu item becomes gray, while the label of that fist menu item stays black and it remains clickable. What is causing this crosstalk between the two icons/drawables? Shouldn't the system handle things like mutate() in this case? I've included a screenshot:

    Read the article

  • getting a gridview and dropdownlist to remember their states after navigate away and back button scr

    - by nat
    hi i have a page filling a gridview which is all working fine. the grid is basically the result of a search .. the filters for which are a number of dropdowns and a couple of textboxes the data from the grid and dropdowns are saved in the session and the whole page lives inside an updatepanel when i navigate away from the page (as it happens by clicking a link inside the grid) and then back button to it, all the droppers are back to their unselected values and the grid is nowhere to be seen.. i understand that this is because of the scriptmanager doesnt do 'standard' postbacks so the browser doesnt realise what has happened. however i have set the EnableHistory to true in the scriptmanager is there an easy way to get this to remember without dropping the updatepanel/scriptmanager? also to complicate things further the scriptmanger /updatepanel is actually in a master page. so not really sure how i can get the navigate bits to work in the scriptmanager.. clearly i am a bit confuised and any help that someone could provide would be happily received thanks nat

    Read the article

  • GridView's ItemContainerStyle and selection states

    - by Roberto Casadei
    I'm trying to change the appearance of gridview items when they are selected. (Before, I used a trick with an IsSelected property in the ViewModel object bound to the containing grid and a bool-to-color converter, but I recognize that it is bad) To do so, I do: <GridView ItemContainerStyle="{StaticResource GridViewItemContainerStyle}" ...> ... and <Style x:Key="GridViewItemContainerStyle" TargetType="GridViewItem"> <Setter Property="Background" Value="Red" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="GridViewItem"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Background)" Storyboard.TargetName="itemGrid"> <DiscreteObjectKeyFrame KeyTime="0" Value="Black"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="SelectionStates"> <VisualState x:Name="UnselectedSwiping"/> <VisualState x:Name="UnselectedPointerOver"/> <VisualState x:Name="Selecting"/> <VisualState x:Name="Selected"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Background)" Storyboard.TargetName="itemGrid"> <DiscreteObjectKeyFrame KeyTime="0" Value="White"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="SelectedSwiping"/> <VisualState x:Name="Unselecting"/> <VisualState x:Name="Unselected"/> <VisualState x:Name="SelectedUnfocused"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid ... x:Name="itemGrid"> <!-- HERE MY DATA TEMPLATE --> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> When I run the app, the items are Black (as in the "normal" state). But selecting them does not turn them into White. Where am I wrong? Moreover, it there a way to set "ItemContainerStyle" without having it to "overwrite" the "ItemTemplate" ???

    Read the article

  • Switching Javascript Function states

    - by webzide
    Dear experts, I would like to implement a API of Javascript that sort of resemble a light switch. For instance, there are two buttons on the actual HTML page act as the UI. Both of the buttons have event handlers that invokes a different function. Each function have codes that act like a state, for instance. button1.onclick=function (){ $("div").click( //code effects 2 ) } button2.onclick=function (){ $("div").click( //Code effects 2 ) } I the code works fine on the surface but the 2 state functions overlap. the effects is going to take place for the rest of the way until the next reload of the document. Basically what I want to achieve is that when 1 button is clicked, it will switch "OFF" the state of function invoked by the other button and vice versa. Thus, the effects achieved are unique are not overlapped. Is there anyway to achieve this or could any experts point me to the right direction. Thanks in advance.

    Read the article

  • Visually [Diagrams/movies] Display events and states of System using old logs of Application to trac

    - by singh
    Hi In My Application many process runs. Having multiple threads in each process. Whenever any bug comes, I have to analyze thousands of lines of logs to know exact root-cause. I am thinking of an idea, Please guide me if it is feasible and good enough Each log have Process name , Thread id , and Time stamp along with message. If I can create a intelligence to capture what is happing with time and display in a movie which user can view it like a normal video. Forward – backward etc. It will help to reach root cause fast and bug tracing will become easy. Please guide me on library in c++ using which I can draw diagrams and display as movie

    Read the article

  • Switching function states

    - by webzide
    Dear experts, I would like to implement a API of Javascript that sort of resemble a light switch. For instance, there are two buttons on the actual HTML page act as the UI. Both of the buttons have event handlers that invokes a different function. Each function have codes that act like a state, for instance. button1.onclick=function (){ $("div").click( //code effects 2 ) } button2.onclick=function (){ $("div").click( //Code effects 2 ) } I the code works fine on the surface but the 2 state functions overlap. the effects is going to take place for the rest of the way until the next reload of the document. Basically what I want to achieve is that when 1 button is clicked, it will switch "OFF" the state of function invoked by the other button and vice versa. Thus, the effects achieved are unique are not overlapped. Is there anyway to achieve this or could any experts point me to the right direction. Thanks in advance.

    Read the article

  • MSVC++ 6.0: Fatal error C1509 "Too many exception handler states in function"

    - by sep332
    I'm working on a project that uses a lot of generated files for a GUI. After some recent updates, I get this error. If I remove some controls (the new ones or some old ones, doesn't seem to matter which), the error goes away. I've temporarily worked around the problem, but I'd like a more permanent solution. I've seen mentioned on the web that there's a fix for this in VS.Net 2003, but I can't find anything for 6.0. Does anyone know of a hotfix or service pack that fixes this?

    Read the article

  • Flash Builder 4 "includeIn" property causing design view error

    - by Chris
    I am creating a custom TextInput component that will define an "error" state. I have extended the TextInput class to change the state to "error" if the errorString property's length is greater than 0. In the skin class, I have defined an "error" state, and added some logic to detect the size and position of the error icon. However, if I have this code at the same time I use the "includeIn" property in the bitmap image tag, I get a design view error. If I either A) Only include that code with no "includeIn" property set, it works or B) dont include the code to set the icon size and position and only use the "includeIn" property, it works. Any ideas what could be causing the design view problem when I use both the "includeIn" property and the icon size/position code at the same time? TextInput Class: package classes { import spark.components.TextInput; public class TextInput extends spark.components.TextInput { [SkinState("error")]; public function TextInput() { super(); } override public function set errorString( value:String ):void { super.errorString = value; invalidateSkinState(); } override protected function getCurrentSkinState():String { if (errorString.length>0) { return "error"; } return super.getCurrentSkinState(); } } } TextInput Skin File: override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //THIS IS THE CODE THAT SEEMS TO BE CAUSING THE PROBLEM if(getStyle("iconSize") == "large") { errorIcon.right = -12; errorIcon.source = new errorIconLg(); } else { errorIcon.right = -5; errorIcon.source = new errorIconSm(); } super.updateDisplayList(unscaledWidth, unscaledHeight); } </fx:Script> <s:states> <s:State name="normal"/> <s:State name="disabled"/> <s:State name="error"/> </s:states> //If I remove the problem code above or if I take out the includeIn //property here, it works <s:BitmapImage id="errorIcon" verticalCenter="0" includeIn="error" /> </s:SparkSkin>

    Read the article

  • How do you handle animations that are for transitioning between states?

    - by yaj786
    How does one usually handle animations that are for going between a game object's states? For example, imagine a very simple game in which a character can only crouch or stand normally. Currently, I use a custom Animation class like this: class Animation{ int numFrames; int curFrame; Bitmap spriteSheet; //... various functions for pausing, returning frame, etc. } and an example Character class class Character{ int state; Animation standAni; Animation crouchAni; //... etc, etc. } Thus, I use the state of the character to draw the necessary animation. if(state == STATE_STAND) draw(standAni.updateFrame()); else if(state == STATE_CROUCH) draw(crouchAni.updateFrame()); Now I've come to the point where I want to draw "in-between" animations, because right now the character will just jump immediately into a crouch instead of bending down. What is a good way to handle this? And if the way that I handle storing Animations in the Character class is not a good way, what is? I thought of creating states like STATE_STANDING_TO_CROUCHING but I feel like that may get messy fast.

    Read the article

  • Creating a framework for ASP.NET web forms similar to Flex states.

    - by Shawn Simon
    I really enjoy the flex states framework. You define a few states for your control, and then can set child controls to only appear in certain states. Check out this code: <s:states> <s:State name="signin"/> <s:State name="register"/> </s:states> <mx:FormItem label="Last name:" includeIn="register" id="lastNameItem" alpha="0.0"> <s:TextInput id="lastName" width="220"/> </mx:FormItem> Now the last name form will only appear in the register screen. This would be really useful I think in .NET where you use the page for views like update / insert. I was considering extending the Page element to have a states property using extension methods, and adding the include in to controls. This way I could auto-hide controls based on the current view at render time. What is even cooler in Flex, is that you can use different handlers / properties based on the current state. <s:Button label="Sign in" label.register="Register" id="loginButton" enabled="true" click.signin="signin()" click.register="register()"/> I'm sure there's a way I could implement something similar to this as well. Do you think this is a good idea? Or does it just add a level of abstraction to framework that already has a poor separation of concerns?

    Read the article

  • Creating a thematic map

    - by jsharma
    This post describes how to create a simple thematic map, just a state population layer, with no underlying map tile layer. The map shows states color-coded by total population. The map is interactive with info-windows and can be panned and zoomed. The sample code demonstrates the following: Displaying an interactive vector layer with no background map tile layer (i.e. purpose and use of the Universe object) Using a dynamic (i.e. defined via the javascript client API) color bucket style Dynamically changing a layer's rendering style Specifying which attribute value to use in determining the bucket, and hence style, for a feature (FoI) The result is shown in the screenshot below. The states layer was defined, and stored in the user_sdo_themes view of the mvdemo schema, using MapBuilder. The underlying table is defined as SQL> desc states_32775  Name                                      Null?    Type ----------------------------------------- -------- ----------------------------  STATE                                              VARCHAR2(26)  STATE_ABRV                                         VARCHAR2(2) FIPSST                                             VARCHAR2(2) TOTPOP                                             NUMBER PCTSMPLD                                           NUMBER LANDSQMI                                           NUMBER POPPSQMI                                           NUMBER ... MEDHHINC NUMBER AVGHHINC NUMBER GEOM32775 MDSYS.SDO_GEOMETRY We'll use the TOTPOP column value in the advanced (color bucket) style for rendering the states layers. The predefined theme (US_STATES_BI) is defined as follows. SQL> select styling_rules from user_sdo_themes where name='US_STATES_BI'; STYLING_RULES -------------------------------------------------------------------------------- <?xml version="1.0" standalone="yes"?> <styling_rules highlight_style="C.CB_QUAL_8_CLASS_DARK2_1"> <hidden_info> <field column="STATE" name="Name"/> <field column="POPPSQMI" name="POPPSQMI"/> <field column="TOTPOP" name="TOTPOP"/> </hidden_info> <rule column="TOTPOP"> <features style="states_totpop"> </features> <label column="STATE_ABRV" style="T.BLUE_SERIF_10"> 1 </label> </rule> </styling_rules> SQL> The theme definition specifies that the state, poppsqmi, totpop, state_abrv, and geom columns will be queried from the states_32775 table. The state_abrv value will be used to label the state while the totpop value will be used to determine the color-fill from those defined in the states_totpop advanced style. The states_totpop style, which we will not use in our demo, is defined as shown below. SQL> select definition from user_sdo_styles where name='STATES_TOTPOP'; DEFINITION -------------------------------------------------------------------------------- <?xml version="1.0" ?> <AdvancedStyle> <BucketStyle> <Buckets default_style="C.S02_COUNTRY_AREA"> <RangedBucket seq="0" label="10K - 5M" low="10000" high="5000000" style="C.SEQ6_01" /> <RangedBucket seq="1" label="5M - 12M" low="5000001" high="1.2E7" style="C.SEQ6_02" /> <RangedBucket seq="2" label="12M - 20M" low="1.2000001E7" high="2.0E7" style="C.SEQ6_04" /> <RangedBucket seq="3" label="&gt; 20M" low="2.0000001E7" high="5.0E7" style="C.SEQ6_05" /> </Buckets> </BucketStyle> </AdvancedStyle> SQL> The demo defines additional advanced styles via the OM.style object and methods and uses those instead when rendering the states layer.   Now let's look at relevant snippets of code that defines the map extent and zoom levels (i.e. the OM.universe),  loads the states predefined vector layer (OM.layer), and sets up the advanced (color bucket) style. Defining the map extent and zoom levels. function initMap() {   //alert("Initialize map view");     // define the map extent and number of zoom levels.   // The Universe object is similar to the map tile layer configuration   // It defines the map extent, number of zoom levels, and spatial reference system   // well-known ones (like web mercator/google/bing or maps.oracle/elocation are predefined   // The Universe must be defined when there is no underlying map tile layer.   // When there is a map tile layer then that defines the map extent, srid, and zoom levels.      var uni= new OM.universe.Universe(     {         srid : 32775,         bounds : new OM.geometry.Rectangle(                         -3280000, 170000, 2300000, 3200000, 32775),         numberOfZoomLevels: 8     }); The srid specifies the spatial reference system which is Equal-Area Projection (United States). SQL> select cs_name from cs_srs where srid=32775 ; CS_NAME --------------------------------------------------- Equal-Area Projection (United States) The bounds defines the map extent. It is a Rectangle defined using the lower-left and upper-right coordinates and srid. Loading and displaying the states layer This is done in the states() function. The full code is at the end of this post, however here's the snippet which defines the states VectorLayer.     // States is a predefined layer in user_sdo_themes     var  layer2 = new OM.layer.VectorLayer("vLayer2",     {         def:         {             type:OM.layer.VectorLayer.TYPE_PREDEFINED,             dataSource:"mvdemo",             theme:"us_states_bi",             url: baseURL,             loadOnDemand: false         },         boundingTheme:true      }); The first parameter is a layer name, the second is an object literal for a layer config. The config object has two attributes: the first is the layer definition, the second specifies whether the layer is a bounding one (i.e. used to determine the current map zoom and center such that the whole layer is displayed within the map window) or not. The layer config has the following attributes: type - specifies whether is a predefined one, a defined via a SQL query (JDBC), or in a json-format file (DATAPACK) theme - is the predefined theme's name url - is the location of the mapviewer server loadOnDemand - specifies whether to load all the features or just those that lie within the current map window and load additional ones as needed on a pan or zoom The code snippet below dynamically defines an advanced style and then uses it, instead of the 'states_totpop' style, when rendering the states layer. // override predefined rendering style with programmatic one    var theRenderingStyle =      createBucketColorStyle('YlBr5', colorSeries, 'States5', true);   // specify which attribute is used in determining the bucket (i.e. color) to use for the state   // It can be an array because the style could be a chart type (pie/bar)   // which requires multiple attribute columns     // Use the STATE.TOTPOP column (aka attribute) value here    layer2.setRenderingStyle(theRenderingStyle, ["TOTPOP"]); The style itself is defined in the createBucketColorStyle() function. Dynamically defining an advanced style The advanced style used here is a bucket color style, i.e. a color style is associated with each bucket. So first we define the colors and then the buckets.     numClasses = colorSeries[colorName].classes;    // create Color Styles    for (var i=0; i < numClasses; i++)    {         theStyles[i] = new OM.style.Color(                      {fill: colorSeries[colorName].fill[i],                        stroke:colorSeries[colorName].stroke[i],                       strokeOpacity: useGradient? 0.25 : 1                      });    }; numClasses is the number of buckets. The colorSeries array contains the color fill and stroke definitions and is: var colorSeries = { //multi-hue color scheme #10 YlBl. "YlBl3": {   classes:3,                  fill: [0xEDF8B1, 0x7FCDBB, 0x2C7FB8],                  stroke:[0xB5DF9F, 0x72B8A8, 0x2872A6]   }, "YlBl5": {   classes:5,                  fill:[0xFFFFCC, 0xA1DAB4, 0x41B6C4, 0x2C7FB8, 0x253494],                  stroke:[0xE6E6B8, 0x91BCA2, 0x3AA4B0, 0x2872A6, 0x212F85]   }, //multi-hue color scheme #11 YlBr.  "YlBr3": {classes:3,                  fill:[0xFFF7BC, 0xFEC44F, 0xD95F0E],                  stroke:[0xE6DEA9, 0xE5B047, 0xC5360D]   }, "YlBr5": {classes:5,                  fill:[0xFFFFD4, 0xFED98E, 0xFE9929, 0xD95F0E, 0x993404],                  stroke:[0xE6E6BF, 0xE5C380, 0xE58A25, 0xC35663, 0x8A2F04]     }, etc. Next we create the bucket style.    bucketStyleDef = {       numClasses : colorSeries[colorName].classes, //      classification: 'custom',  //since we are supplying all the buckets //      buckets: theBuckets,       classification: 'logarithmic',  // use a logarithmic scale       styles: theStyles,       gradient:  useGradient? 'linear' : 'off' //      gradient:  useGradient? 'radial' : 'off'     };    theBucketStyle = new OM.style.BucketStyle(bucketStyleDef);    return theBucketStyle; A BucketStyle constructor takes a style definition as input. The style definition specifies the number of buckets (numClasses), a classification scheme (which can be equal-ranged, logarithmic scale, or custom), the styles for each bucket, whether to use a gradient effect, and optionally the buckets (required when using a custom classification scheme). The full source for the demo <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Oracle Maps V2 Thematic Map Demo</title> <script src="http://localhost:8080/mapviewer/jslib/v2/oraclemapsv2.js" type="text/javascript"> </script> <script type="text/javascript"> //var $j = jQuery.noConflict(); var baseURL="http://localhost:8080/mapviewer"; // location of mapviewer OM.gv.proxyEnabled =false; // no mvproxy needed OM.gv.setResourcePath(baseURL+"/jslib/v2/images/"); // location of resources for UI elements like nav panel buttons var map = null; // the client mapviewer object var statesLayer = null, stateCountyLayer = null; // The vector layers for states and counties in a state var layerName="States"; // initial map center and zoom var mapCenterLon = -20000; var mapCenterLat = 1750000; var mapZoom = 2; var mpoint = new OM.geometry.Point(mapCenterLon,mapCenterLat,32775); var currentPalette = null, currentStyle=null; // set an onchange listener for the color palette select list // initialize the map // load and display the states layer $(document).ready( function() { $("#demo-htmlselect").change(function() { var theColorScheme = $(this).val(); useSelectedColorScheme(theColorScheme); }); initMap(); states(); } ); /** * color series from ColorBrewer site (http://colorbrewer2.org/). */ var colorSeries = { //multi-hue color scheme #10 YlBl. "YlBl3": { classes:3, fill: [0xEDF8B1, 0x7FCDBB, 0x2C7FB8], stroke:[0xB5DF9F, 0x72B8A8, 0x2872A6] }, "YlBl5": { classes:5, fill:[0xFFFFCC, 0xA1DAB4, 0x41B6C4, 0x2C7FB8, 0x253494], stroke:[0xE6E6B8, 0x91BCA2, 0x3AA4B0, 0x2872A6, 0x212F85] }, //multi-hue color scheme #11 YlBr. "YlBr3": {classes:3, fill:[0xFFF7BC, 0xFEC44F, 0xD95F0E], stroke:[0xE6DEA9, 0xE5B047, 0xC5360D] }, "YlBr5": {classes:5, fill:[0xFFFFD4, 0xFED98E, 0xFE9929, 0xD95F0E, 0x993404], stroke:[0xE6E6BF, 0xE5C380, 0xE58A25, 0xC35663, 0x8A2F04] }, // single-hue color schemes (blues, greens, greys, oranges, reds, purples) "Purples5": {classes:5, fill:[0xf2f0f7, 0xcbc9e2, 0x9e9ac8, 0x756bb1, 0x54278f], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] }, "Blues5": {classes:5, fill:[0xEFF3FF, 0xbdd7e7, 0x68aed6, 0x3182bd, 0x18519C], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] }, "Greens5": {classes:5, fill:[0xedf8e9, 0xbae4b3, 0x74c476, 0x31a354, 0x116d2c], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] }, "Greys5": {classes:5, fill:[0xf7f7f7, 0xcccccc, 0x969696, 0x636363, 0x454545], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] }, "Oranges5": {classes:5, fill:[0xfeedde, 0xfdb385, 0xfd8d3c, 0xe6550d, 0xa63603], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] }, "Reds5": {classes:5, fill:[0xfee5d9, 0xfcae91, 0xfb6a4a, 0xde2d26, 0xa50f15], stroke:[0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3, 0xd3d3d3] } }; function createBucketColorStyle( colorName, colorSeries, rangeName, useGradient) { var theBucketStyle; var bucketStyleDef; var theStyles = []; var theColors = []; var aBucket, aStyle, aColor, aRange; var numClasses ; numClasses = colorSeries[colorName].classes; // create Color Styles for (var i=0; i < numClasses; i++) { theStyles[i] = new OM.style.Color( {fill: colorSeries[colorName].fill[i], stroke:colorSeries[colorName].stroke[i], strokeOpacity: useGradient? 0.25 : 1 }); }; bucketStyleDef = { numClasses : colorSeries[colorName].classes, // classification: 'custom', //since we are supplying all the buckets // buckets: theBuckets, classification: 'logarithmic', // use a logarithmic scale styles: theStyles, gradient: useGradient? 'linear' : 'off' // gradient: useGradient? 'radial' : 'off' }; theBucketStyle = new OM.style.BucketStyle(bucketStyleDef); return theBucketStyle; } function initMap() { //alert("Initialize map view"); // define the map extent and number of zoom levels. // The Universe object is similar to the map tile layer configuration // It defines the map extent, number of zoom levels, and spatial reference system // well-known ones (like web mercator/google/bing or maps.oracle/elocation are predefined // The Universe must be defined when there is no underlying map tile layer. // When there is a map tile layer then that defines the map extent, srid, and zoom levels. var uni= new OM.universe.Universe( { srid : 32775, bounds : new OM.geometry.Rectangle( -3280000, 170000, 2300000, 3200000, 32775), numberOfZoomLevels: 8 }); map = new OM.Map( document.getElementById('map'), { mapviewerURL: baseURL, universe:uni }) ; var navigationPanelBar = new OM.control.NavigationPanelBar(); map.addMapDecoration(navigationPanelBar); } // end initMap function states() { //alert("Load and display states"); layerName = "States"; if(statesLayer) { // states were already visible but the style may have changed // so set the style to the currently selected one var theData = $('#demo-htmlselect').val(); setStyle(theData); } else { // States is a predefined layer in user_sdo_themes var layer2 = new OM.layer.VectorLayer("vLayer2", { def: { type:OM.layer.VectorLayer.TYPE_PREDEFINED, dataSource:"mvdemo", theme:"us_states_bi", url: baseURL, loadOnDemand: false }, boundingTheme:true }); // add drop shadow effect and hover style var shadowFilter = new OM.visualfilter.DropShadow({opacity:0.5, color:"#000000", offset:6, radius:10}); var hoverStyle = new OM.style.Color( {stroke:"#838383", strokeThickness:2}); layer2.setHoverStyle(hoverStyle); layer2.setHoverVisualFilter(shadowFilter); layer2.enableFeatureHover(true); layer2.enableFeatureSelection(false); layer2.setLabelsVisible(true); // override predefined rendering style with programmatic one var theRenderingStyle = createBucketColorStyle('YlBr5', colorSeries, 'States5', true); // specify which attribute is used in determining the bucket (i.e. color) to use for the state // It can be an array because the style could be a chart type (pie/bar) // which requires multiple attribute columns // Use the STATE.TOTPOP column (aka attribute) value here layer2.setRenderingStyle(theRenderingStyle, ["TOTPOP"]); currentPalette = "YlBr5"; var stLayerIdx = map.addLayer(layer2); //alert('State Layer Idx = ' + stLayerIdx); map.setMapCenter(mpoint); map.setMapZoomLevel(mapZoom) ; // display the map map.init() ; statesLayer=layer2; // add rt-click event listener to show counties for the state layer2.addListener(OM.event.MouseEvent.MOUSE_RIGHT_CLICK,stateRtClick); } // end if } // end states function setStyle(styleName) { // alert("Selected Style = " + styleName); // there may be a counties layer also displayed. // that wll have different bucket ranges so create // one style for states and one for counties var newRenderingStyle = null; if (layerName === "States") { if(/3/.test(styleName)) { newRenderingStyle = createBucketColorStyle(styleName, colorSeries, 'States3', false); currentStyle = createBucketColorStyle(styleName, colorSeries, 'Counties3', false); } else { newRenderingStyle = createBucketColorStyle(styleName, colorSeries, 'States5', false); currentStyle = createBucketColorStyle(styleName, colorSeries, 'Counties5', false); } statesLayer.setRenderingStyle(newRenderingStyle, ["TOTPOP"]); if (stateCountyLayer) stateCountyLayer.setRenderingStyle(currentStyle, ["TOTPOP"]); } } // end setStyle function stateRtClick(evt){ var foi = evt.feature; //alert('Rt-Click on State: ' + foi.attributes['_label_'] + // ' with pop ' + foi.attributes['TOTPOP']); // display another layer with counties info // layer may change on each rt-click so create and add each time. var countyByState = null ; // the _label_ attribute of a feature in this case is the state abbreviation // we will use that to query and get the counties for a state var sqlText = "select totpop,geom32775 from counties_32775_moved where state_abrv="+ "'"+foi.getAttributeValue('_label_')+"'"; // alert(sqlText); if (currentStyle === null) currentStyle = createBucketColorStyle('YlBr5', colorSeries, 'Counties5', false); /* try a simple style instead new OM.style.ColorStyle( { stroke: "#B8F4FF", fill: "#18E5F4", fillOpacity:0 } ); */ // remove existing layer if any if(stateCountyLayer) map.removeLayer(stateCountyLayer); countyByState = new OM.layer.VectorLayer("stCountyLayer", {def:{type:OM.layer.VectorLayer.TYPE_JDBC, dataSource:"mvdemo", sql:sqlText, url:baseURL}}); // url:baseURL}, // renderingStyle:currentStyle}); countyByState.setVisible(true); // specify which attribute is used in determining the bucket (i.e. color) to use for the state countyByState.setRenderingStyle(currentStyle, ["TOTPOP"]); var ctLayerIdx = map.addLayer(countyByState); // alert('County Layer Idx = ' + ctLayerIdx); //map.addLayer(countyByState); stateCountyLayer = countyByState; } // end stateRtClick function useSelectedColorScheme(theColorScheme) { if(map) { // code to update renderStyle goes here //alert('will try to change render style'); setStyle(theColorScheme); } else { // do nothing } } </script> </head> <body bgcolor="#b4c5cc" style="height:100%;font-family:Arial,Helvetica,Verdana"> <h3 align="center">State population thematic map </h3> <div id="demo" style="position:absolute; left:68%; top:44px; width:28%; height:100%"> <HR/> <p/> Choose Color Scheme: <select id="demo-htmlselect"> <option value="YlBl3"> YellowBlue3</option> <option value="YlBr3"> YellowBrown3</option> <option value="YlBl5"> YellowBlue5</option> <option value="YlBr5" selected="selected"> YellowBrown5</option> <option value="Blues5"> Blues</option> <option value="Greens5"> Greens</option> <option value="Greys5"> Greys</option> <option value="Oranges5"> Oranges</option> <option value="Purples5"> Purples</option> <option value="Reds5"> Reds</option> </select> <p/> </div> <div id="map" style="position:absolute; left:10px; top:50px; width:65%; height:75%; background-color:#778f99"></div> <div style="position:absolute;top:85%; left:10px;width:98%" class="noprint"> <HR/> <p> Note: This demo uses HTML5 Canvas and requires IE9+, Firefox 10+, or Chrome. No map will show up in IE8 or earlier. </p> </div> </body> </html>

    Read the article

  • State Animation on ListBox ItemTemplate

    - by Peanut
    I have a listbox which reads from Observable collection, and is ItemTemplate'ed: <DataTemplate x:Key="DataTemplate1"> <Grid x:Name="grid" Height="47.333" Width="577" Opacity="0.495"> <Image HorizontalAlignment="Left" Margin="10.668,8,0,8" Width="34" Source="{Binding ImageLocation}"/> <TextBlock Margin="56,8,172.334,8" TextWrapping="Wrap" Text="{Binding ApplicationName}" FontSize="21.333"/> <Grid x:Name="grid1" HorizontalAlignment="Right" Margin="0,10.003,-0.009,11.33" Width="26" Opacity="0" RenderTransformOrigin="0.5,0.5"> <Image HorizontalAlignment="Stretch" Margin="0" Source="image/downloads.png" Stretch="Fill" MouseDown="Image_MouseDown" /> </Grid> </Grid> </DataTemplate> <ListBox x:Name="searchlist" Margin="8" ItemTemplate="{DynamicResource DataTemplate1}" ItemsSource="{Binding SearchResults}" SelectionChanged="searchlist_SelectionChanged" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" /> In general, my question is "What is the easiest way to do Animation on Particular Items in this listbox As they are selected? Basically the image inside the "grid1" will be setting its opacity to 1, slowly. I would prefer to use states, but I do not know of any way to just tell blend and xaml to "When a selected item is changed, change the image opacity to 1 over a period of .3 seconds". Infact, I have been doing this in the .cs file using the VisualStateManager. Also, there is another issue. When the selected index is changed, we goto the CS file and look at SelectedItem. SelectedItem returns an instance of the Object in which it was bound to (The object inside the observable collection), and NOT an instance of the DataTemplate/ListItem etc. So how am I able to pull the correct image out of this list? State animation with VisualStateManager I can handle fine if its just normal things, but when it comes to generated listboxes' items, I'm lost. Thanks

    Read the article

  • In a state machine, is it a good idea to separate states and transitions?

    - by codablank1
    I have implemented a small state machine in this way (in pseudo code): class Input {} class KeyInput inherits Input { public : enum { Key_A, Key_B, ..., } } class GUIInput inherits Input { public : enum { Button_A, Button_B, ..., } } enum Event { NewGame, Quit, OpenOptions, OpenMenu } class BaseState { String name; Event get_event (Input input); void handle (Event e); //event handling function } class Menu inherits BaseState{...} class InGame inherits BaseState{...} class Options inherits BaseState{...} class StateMachine { public : BaseState get_current_state () { return current_state; } void add_state (String name, BaseState state) { statesMap.insert(name, state);} //raise an exception if state not found BaseState get_state (String name) { return statesMap.find(name); } //raise an exception if state or next_state not found void add_transition (Event event, String state_name, String next_state_name) { BaseState state = get_state(state_name); BaseState next_state = get_state(next_state_name); transitionsMap.insert(pair<event, state>, next_state); } //raise exception if couple not found BaseState get_next_state(Event event, BaseState state) { return transitionsMap.find(pair<event, state>); } void handle(Input input) { Event event = current_state.get_event(input) current_state.handle(event); current_state = get_next_state(event, current_state); } private : BaseState current_state; map<String, BaseState> statesMap; //map of all states in the machine //for each couple event/state, this map stores the next state map<pair<Event, BaseState>, BaseState> transitionsMap; } So, before getting the transition, I need to convert the key input or GUI input to the proper event, given the current state; thus the same key 'W' can launch a new game in the 'Menu' state or moving forward a character in the 'InGame' state; Then I get the next state from the transitionsMap and I update the current state Does this configuration seem valid to you ? Is it a good idea to separate states and transitions ? And I have some kind of trouble to represent a 'null state' or a 'null event'; What initial value can I give to the current state and which one should be returned by get_state if it fails ?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >