Raphael js get element's rotation - get

Is there a way to get an elements rotation value using the raphaeljs library? I'm sure there is but I can't find it anywhere in the documentation. I imagine its goes something like this .attr('rotation') but this doesn't work.

Use the Element.transform() function to get the current transformation data as well as to set it.
You probably already know that element.transform(tstring) sets the transform data, including rotation.
To get that data back from Raphael, simply call element.transform() without any parameters:
tstring = element.transform();`
Hope that helps.

Here are four ways I've found to get a Raphaël element's rotation value:
console.log(el.attr('transform')[0][1]);
console.log(el.transform()[0][1]);
console.log(el.matrix.split().rotate);
console.log(el.matrix.toTransformString().split('r')[1]);
Specific outputs differ based on previously applied transformations.
If no transformation has yet been applied, the first two will throw 'cannot read property of undefined' errors, the second will log -0, and the fourth will log undefined.
If a previous transformation between -90° and 269.999° (inclusive) has been applied, all four log that transformation (though the third will be off by a few decimals, and the fourth will be followed by 0,0).
If a previous transformation outside the above range has been applied, the first two log that complete transformation, and the second two log a value relative to and less than 360° (and again, the third will be off by a few decimals, and the fourth will be followed by 0,0).
If multiple transformations have been applied to the element, these get pushed onto the array that's accessed by the first two, and thus the first bracket-notation index would need to be adjusted accordingly (or it will only log the first rotation applied, not the sum of all rotations).
DOCS:
http://raphaeljs.com/reference.html#Element.attr
http://raphaeljs.com/reference.html#Element.transform
http://raphaeljs.com/reference.html#Matrix.split

Related

How to subset a linnet object

I would like to subset a linnet object to get a list of linnet objects. In the helpfile I see that this is possible with a owin object. But I get errors as the syntax is not clear to me and also not clear is the use of snip argument in the call to subset.
I want to split linnet based on a user-attribute coming from marks or split a linnet object based on a windows (each window being a polygon from an shapefile)
Could someone please suggest how to subset a linnet based on a factor/window to get a list of linnet objects:
Using a user attribute/factor/mark on line segments.
Same values of marks are on contagious line segments, so this is ideally similar to using a window.
Using polygons as owin.
Thank you
If L is a network and P is a polygonal window then L[P] computes the intersection of L and P.
The help file for [.linnet includes examples which demonstrate the syntax of this command and which show the effect of the argument snip.

How to pass gnuradio-like tags in REDHAWK

I'm trying to replicate gnuradio-like tags in REDHAWK, SRI looks a bit promising but I'm not sure that I can achieve my goal with that tool.
I'll give a basic example, let's say that I have a component that detects that a certain signal starts at a position. This component doesn't do anything else but this. I'd like to pass this information onto the second component so that It can start working from that position forward.
Is there any way to mark the specific position in the bulkio stream and pass it to the next component?
gnuradio has tags, that can pass any userdata between computational components, and it's precise to the bit.
Have you tried using keywords? They are part of the SRI data structures and are a list of key value pairs. The key is a user defined string and the value is any standard type (double, string, int, etc). Here is how front end devices use them to pass along filter bandwidth and frequency information: http://redhawksdr.github.io/Documentation/mainap6.html#x25-542000F.5.2

Retrieving column values in filtered xpages view

I have a view defined on an xpage. I also have several filters (based on the columns) that the user can select and combine to filter the results in the view. I generate a query string based on this that I construct in dominoView.search (doing a complete refresh). What I would like to do is get the results of the search so that I can then update some counts displayed elsewhere on the page. I'm having a hard time figuring out where I can perform this logic, though. I'm trying to use view.getAllEntries() and then iterating over the collection. Sometimes it seems like it works, but other times I seem to be getting the unfiltered view. Someone suggested I explicitly call view.FTSearch inside one of the events (beforePageLoad?) and immediately after do my getAllEntries call, saving the results in viewScope, but I get an "Error while browses Notes view" runtime error when I try to do that. Any pointers? TIA!
EDIT: After studying the xpages lifecycle a bit (which is still a little confusing), I think I can fine-tune my question. This is my first stackoverflow question, so I hope this is okay to do and productive....
As I described, I have a dominoView defined on my xpage. A repeat iterates over the rows of the view, displaying certain fields from the documents. If I define a query in the search property, then the repeat correctly displays the reduced set of documents rather than the complete set. (The query is computed in the search property via SSJS from some variables defined in the viewScope in a combobox's eventHandler.) However, if I try to access the current entries in the view inside of the repeat's rendered section (with SSJS) using myView.getAllEntries (where myView is what's defined as the "value" of the repeat), I am still getting all of the documents, even if a query has been done. It seems like at that point, the view variable has already had its search applied (since the repeat works), so why the differing results? Is there another way to access the view's rows? To complicate this further, this is just a simple experiment that might clarify the problem; as I indicated earlier, I don't actually want to access the view data within the repeat, I want to access it in the rendered or value sections of some comboboxes defined before the repeat in the xpage file.
I hope that makes more sense now....
EDIT #2: I forgot to add that if I manually call FTSearch (or FTSearchSorted) before calling myView.getAllEntries, then I think I can make this work. It just seems unnecessary to have to do that in addition to the view's built-in search.
From what I get you want to iterate over the entries in a view that before has been filtered, i.e. whose resulting entry collection is smaller than the the view itself.
What I don't get (yet) is what you want to do with the result, or what you're axpecting to get from the iteration over your filtered view (you're mentioning some counts to be displayed somewhere else).
Probably a good way is to use the view's .getAllEntriesByKey method which returns a NotesViewEntryCollection object which then can be used for your iteration.
Don't forget to recycle the resulting NotesViewEntry objects; reason for this has been explained several times here at stackoverflow.

Attaching arbitrary data to objects in D3.js

This relates mostly with what a "best practice" would be with D3.js. I want to attach arbitrary information to different svg elements that I have on a page, after they are created. In D3, it looks like one generally generates svg elements from a dataset. I want to attach data to these svg elements at any time, without adding their HTML attributes.
Is there a good way of doing this? Do I need to use an auxillary array/object or is there a way to apply data to the elements themselves?
You would use the datum method if you want to attach arbitrary data:
D3.select('#mynodeId').datum( mydata );
And then later you could access the value again:
var mydata = D3.select('#mynodeId').datum();
Internally, D3 is going to use the __data__ property of the node, just like it does when the nodes were created from a data set via the selectAll, enter, append sequence.
Note that if you already have a reference to a DOM node you can pass it as the parameter to D3.select rather than making it re-look-up based on selector syntax:
D3.select( anExistingDOMNodeReference ).datum( mydata );
From the API doc:
d3.select(node): Selects the specified node. This is useful if you already have a reference to a node, such as d3.select(this) within an event listener, or a global such as document.body.

Storing index values in FAST-ESP without modifications

first of all I'm totally new to FAST but I already have a couple of issues I need to solve, so I'm sorry if my questions are very basic =)
Well, the problem is that I have a field in the FAST index which in the source document is something like "ABC 12345" (please note the intentional whitespaces) but when stored in the index is in the form "ABC 123456" (please note that now there is a single space).
If I retrieve all the document values then this specific value is OK (with all the whitespaces), my only problem is with the way the value is stored in the index since I need to retrieve and display it to my user just like it appears in the original document, and I don't want to go to the full document just for this value, I want the value that I already have in the index. I think I need to update one of the FAST XML configuration files but I don't have enough documentation at hand in order to decide where to perform the change, index_profile.xml? in the XMLMapper file?
I've found the answer by myself. I'm using a XMLMapper for my collection, all I had to do was to add the ignore-whitespace attribute to the Mapping element and then set this attribute value to "false". This solved the problem and the raw data now when retrieved from the index contains the expected inner whitespaces.
Thanks.

Resources