orientdb geospatial request - geospatial

I created a spacial class OPoint and I created some points
create property Tag.coor EMBEDDED Opoint
update Tag set coor = ST_GeomFromText(WKT)
insert into Tag set name=‘tag01’, coor= {"#class": "OPoint","coordinates" : [1,1]}
insert into Tag set name=‘tag02’, coor= {"#class": "OPoint","coordinates" : [2,2]}
insert into Tag set name=‘tag03’, coor= {"#class": "OPoint","coordinates" : [3,3]}
insert into Tag set name=‘tag04’, coor= {"#class": "OPoint","coordinates" : [4,4]}
I want to make a polygon request which returns all the points in the polygon: something like
SELECT FROM tag WHERE polygon (0 0, 0 2, 2 2, 2 0, 0 0)
expected result:
tag01 (1 1)
tag02 (2 2)

Take a look to spatial functions., especially http://orientdb.com/docs/last/Spatial-Index.html#stwithin
The showed example fit your use case, I guess

Thx I find the good command (ST_WITHIN):
select coor from Tag where ST_WITHIN(coor,'POLYGON ((0 0, 20 0, 20 20,0 20, 0 0))') = true

Related

Visio Shape Text positioning below the shape using Text Transform

I have a building a set of stencil shapes and I need the text to display below the shape. I am using custom formulas to generate the text, and as such the volume of text changes from use case to use case.
What I have come across is using the Text Transform set of properties, and I have tried the following with success for a single line of text:
TxtWidth = TEXTWIDTH(TheText)
TxtPinX = Width * 0.5
TxtLocPinX = TxtWidth * 0.5
TxtHeight = Height * 0
TxtPinY = Height * -0.2
TxtLocPinY = TxtHieght * 0.5
TxtAngle = 0 deg
The problem arises when there is more than a single line of text to display -> the text appears 'half above (inside) and half below' the bottom the shape.
I would like to place all the text, regardless of how many lines there are, underneath the shape.
What I have tried is to set the TxtPinY = some formula different from above eg/ Height * -(TxtHeight). This seems to always result in an 'error in formula'.
I am sure that this is something simple that I am missing, but I cannot figure it out.
Can anybody point me in the right direction?
Cheers and thanks for taking a look at this,
The Frog
You could try the TEXTHEIGHT function to get around this. Specify a reasonable maximum text widht as a second parameter for it:
TxtHeight = TEXTHEIGHT(TheText,100)
TxtPinY = 0
TxtLocPinY = TxtHeight
You can use the code provided with the stencil available in this post:
http://visguy.com/vgforum/index.php?topic=7461.msg31490#msg31490

BadMatch error on XCreateWindow for InputOnly window

I am trying to create a window with Xlib like this:
XSetWindowAttributes win_attribs;
::memset((void *)&win_attribs, 0, sizeof(win_attribs));
unsigned long win_attribs_mask;
win_attribs.override_redirect = True;
win_attribs_mask = CWOverrideRedirect;
Window win = XCreateWindow(display,
XDefaultRootWindow(display);
0,
0,
1, 1,
0,
0,
InputOnly,
CopyFromParent,
win_attribs_mask,
&win_attribs));
Which results in X11 Error 8 (BadMatch (invalid parameter attributes)): request 55.0.
I have read the documentation which parameters might be wrong here:
https://tronche.com/gui/x/xlib/window/XCreateWindow.html
But I cannot figure out what is going on and why this error is spit out. The manual states that an InputOnly window needs a depth of 0, a valid visual which is the one from the parent and can only set certaint window attributes (of which CWOverrideRedirectis one of).
Which parameter might be wrong here?

Appropriate Syntax For Alternating Row Colors

I am using this code:
=IIF(RunningValue(Fields!cost_center_id.Value, CountDistinct, nothing) Mod 2, "White", "Gainsboro")
But its result is not good. I think it's because of Fields!cost_center_id.Value. Can anybody tell me the most appropriate code?
And why the footer (Total) has also shade thought I haven't put code in it? Help me.
Thanks in advance.
Screenshots:
I used this code for the 3rd picture.
= IIF(RowNumber("LCSRDBDataSet_CostCenterSummary") Mod 2 = 0, "White", "Gainsboro")
The reason your expression doesn't work is because your id values might have gaps or not be ordered correctly.
One of these following expressions should give the wanted behavior.
= IIF(RowNumber(Nothing) Mod 2 = 0, "White", "Gainsboro")
= IIF(RowNumber("YourDataSet") Mod 2 = 0, "White", "Gainsboro")
You need to define the expression for the BackgroundColorproperty of the data row. The footer row (total) should be below the data row, and thus have no expression for it's background color, unless you want it to be different to the final row.

Fl_Scroll initial scroll values

I'm using FLTK for a project (the version distributed with Debian/sid 1.3.2-6+b1) and I'm having some trouble initializing Fl_Scroll's content scroll values.
I create a Fl_Double_Window and on the right side a vertical panel using Fl_Scroll, it is positioned at left x 600 and top y 24.
Then I set Fl_Scroll's type to Fl_Scroll::VERTICAL and place a Fl_Button inside, everything works fine.
The problem? Fl_Scroll initialize already scrolled with xposition() = 600 and yposition() = 24 (X and Y of the Fl_Scroll's constructor?? Is supposed to work so?), instead I want it to initialize with content scrolled at left and top 0, 0, so I tried scroll_to() in different places, before and after window's show(), on FL_SHOW of the subclassed Fl_Scroll (I didn't really need to subclass Fl_Scroll, just trying to get scroll_to() working), also on overridden draw() after
the parent draw(), even creating Fl_Scroll at 0, 0 then position() at 600, 24, but nothing.
The only way I got scroll_to() working is if I call it from an async event after the application initialize (FL_KEYUP).
Here's the overridden Fl_Double_Window window constructor:
group = new Fl_Group(0, 0, WIN_W, WIN_H);
{
menu = new Fl_Menu_Bar(0, 0, WIN_W, MENU_H);
menu->add("File/Quit", FL_CTRL+'q', cbMenuQuit_i);
glview = new CGLView(0, MENU_H, WIN_W-PROPS_W+1, WIN_H-MENU_H);
group->resizable(glview);
scroll = new CScroll(WIN_W-PROPS_W, MENU_H, PROPS_W-1, WIN_H-MENU_H);
scroll->type(Fl_Scroll::VERTICAL);
{
Fl_Pack *pack = new Fl_Pack(0, 0, PROPS_W-1, WIN_H-1);
{
btnAddLayer = new Fl_Button(0, 0, PROPS_W, 32, "##+ Add Layer");
btnAddLayer->callback(btnAddLayerCb_i, (void *)this);
}
pack->end();
}
scroll->end();
}
group->end();
end();
size_range(WIN_MIN_W, WIN_MIN_H); /* Make the window resizable */
show();
Never mind, got it, two altenative:
create Fl_Scroll at 0, 0 then position() it after scroll->end()
create Fl_Scroll at the wanted position then after scroll->end() use negative values scroll_to(-X, -Y)
In both cases is important that the widgets contained are already added (scroll_to() alter cotained widgets coords)
Isn't clear to me why X and Y of Fl_Scroll's constructor are used.

How can I achieve this kind of List in BlackBerry?

I am making my first application for BlackBerry (OS 6.0+) and I have to define a screen like in the image below. I have read about RichList but its not allowed to be added below the other components.
What I want is the part (list) below the wide ButtonField. The white boxes should contain images and the scribbles in front of it should contain text. This "list items" are populated dynamically.
As you can see, this very-much resembles the layout of a RichList, but I can't seem to add it to the VerticalFieldManager that I have used as the main container of components.
So if anyone can help me get this screen, I'm really grateful! Thanks in advance.
You need to implement ListFieldCallback and overwrite all methods. There you will see "drawListRow" method. You need to draw Images on left and text on write on this method index wise. like this:-
ListData ld = (ListData) rows.elementAt(index);
g.drawText(ld.name, 30+extraSpaceDelete, y
+ (listItemHeight - g.getFont().getHeight()) / 2);
g.drawText(ld.address, 30+extraSpaceDelete, (y
+ (listItemHeight - g.getFont().getHeight()) / 2)+(g.getFont().getAscent()+10));
g.drawBitmap(0, y + listItemH - 3, Display.getWidth(), 3,
separator_line, 0, 0);

Resources