FAQ Database Discussion Community


D3 Force Layout: How to dynamically orient teardrop-shaped nodes?

javascript,d3.js,nodes,shape,force-layout
I want to have teardrop-shaped nodes with dynamic orientation, such that the directionality of the node alone reveals its source and target node. This is my code so far (the code for the teardrop was taken from this example: http://bl.ocks.org/mbostock/849853) and the graph it produces: http://jsbin.com/kigiwinida/edit?html,output But what I ultimately...

rounded corner for button not working

java,android,json,button,shape
I am getting color code #3a87ad from the server to set as the background, and I am also trying to give a rounded corner shape to my button. However it always shows the black color as background. tv_img_tag = (Button) vi.findViewById(R.id.tv_img_tag); tv_img_tag.setBackgroundColor(Color.parseColor(product .get("stop_status_color"))); tv_img_tag.setBackgroundResource(R.drawable.roundedtexts); tv_img_tag.setText(product.get("stop_status_name").toString()); roundedtexts.xml <?xml version="1.0" encoding="utf-8"?> <shape...

Is it possible to scan Logical Gates from a handrawn image

android,image-processing,shape,digital-logic
I am thinking of a project for my university the teachers liked it but I am not sure if its even possible. I am trying to make an andriod app. What I want to do is take a picture of a hand drawn logic circuit (having the AND, OR, NOT...

I would like to make a button selected using selector item with shape in android

android,selector,shape
I have defined button style using selector with shape and kept the same in the drawable folder. Then attached it with the buttons in a layout file. The button background color has been changed on pressing a button, but default color is showing after releasing the button. What I want...

Java 2D : Creating Shape Fixtures

java,swing,shape,java-2d
I'm wondering if there is a way to create a shape fixture in Java 2D. More specifically, I'm trying to be able to draw a predefined shape at different locations with different colors. I know you can use the fill(shape) methods to draw shapes. However, this seems to require creating...

issue :display shape android

android,imagebutton,shape
I want to test my android application in a real device ,i tested first in a mobile with android version jelly bean 4.2.2 ,it worked well without any problem but when i tested with another version(4.1.2) there was a problem :The transparent background of the images that i changed their...

Create a rounded shape

android,xml,shape
I want to create a shape like the image below through xml. Searched a lot to make the corners smooth but not able to make it circular! ...

How to retrieve the coordinates of a Line2D in Java

java,line,coordinates,shape,rectangles
So am trying to retrieve the coordinates of a line 2D that i will draw on my JPanel. The getBounds() method seemed to work for a rectangle2D but is not appripriate for a line2D.. How can i get the the coordinates of a line2D and put them in a variable...

How to clear shapes after the map is redrawn in Google maps?

javascript,json,google-maps-api-3,overlay,shape
I want to clear google map overlay shapes after they are redrawn using JSON string but its not clearing after the map is redrawn using Json string. When i draw shapes and click save raw(IO.IN(shapes,false)) and after that if i click clear button, it clear all shapes. After i saved...

Use XAML StringFormat to get one decimal place

wpf,slider,shape
I have this Circle Slider: And this is my TextBlock inside: <TextBlock Text="{Binding Path=Value, ElementName=knobSlider}" Foreground="White" FontFamily="Trebuchet MS" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.7,2.478" Margin="59,100,44,26" Width="47" /> How can i convert the Slider value from double to only one decimal place and put this text in the middle of the circle ?...

numpy random numpers in specified shape of any complexity

python,numpy,random,numbers,shape
def shaperand(s): r = [] for i in s: if type(i) in [list,tuple]: r.append(shaperand(i)) else: r.append(np.random.rand()) return r So, shaperand([[1,2],[3,4,5],[6,7]]) results in: [[0.27611814857329864, 0.6271028191307862], [0.6245245446787084, 0.743259931401167, 0.9061663248784034], [0.7236900927531255, 0.540622773908648]] I didn't see a function to do this. If there's one it'd be faster. Is there a better, more nifty way...

VBA valid RGB value throws out of range exception

excel,vba,rgb,shape,outofrangeexception
I pieced together the following code from other StackOverflow articles that solved similar problems. Dim light As MsoRGBType, dark As MsoRGBType light = RGB(195, 214, 155) dark = RGB(79, 98, 40) ws.Shapes("Arrow1").Fill.ForeColor.RGB = dark In the last line of code, I get the error: Runtime Error '-2147024809 (80070057)': The value...

How to Create tilted actionbar (toolbar) in Android?

android,android-actionbar,shape
I want to create ActionBar as below. How can we create? How should I create it? https://www.dropbox.com/s/su4ra7z7lyirfto/actionbar.png?dl=0 (image link)...

Rotate a shape on the same axis in java

java,jpanel,axis,shape,translate
I have this program below. I want the program to rotate the shape on the same spot and also rotate the rectangle more than once. However, the program only rotates the rectangle once and puts the rotated shape on another spot on the frame. I really need help. Thanks!!!!* import...

How can I check if two plots have the same shape in R?

r,plot,ggplot2,shape
I have a dataset with variables x, y1 and y2. If I plot(x,y1) and plot(x,y2) the plots look almost the same, but I would like to measure how much they are alike. Is there a function or measurement for it? Is this possible in R? Only the shape of the...

How can i split an ArrayList of Shapes into partitions/lists in Java (Just advice)

java,arrays,arraylist,entity-relationship,shape
I just want an advice or suggestions of how i can do it. i've been thinking about it for hours now and can't find a solution. My aim is to convert this ER Diagram to tables. So i have a Rectangle(Entity) that is linked to an ellipse(Attribute). I've already worked...

Custom Shapes :Android

android,xml,drawable,shape,layer-list
I want to draw custom shapes like this- I want to make this using xml.I cant seem to understand the use of layer-list and items as they are behaving weirdly. How should I draw the shape like this? Don't expect complete code, just give me idea or point me in...

How to create rectangle with one shorter side?

android,shape,android-drawable,drawrectangle
I'm trying to draw a rectangle with one shorter side like in the image below: This is what I have for the moment, but my code doesn't work all I'm drawing is a black rectangle. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="1dp" android:color="#000000" /> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>...

New Created Custom List Shape Doesn't Work in Microsoft Visio 2013 x64

shape,visio,shapes,stencils,shapesheet
Objective: First, I should say what I want to do, and then I'll describe what I've done to achieve to my Goal in the next (Descriptions) part. I want to create a Custom List Master Shape from the Plain Container of the Diagram Parts section in the Insert tab of...

How to add data from one ArrayList to another ArrayList using Java?

java,arrays,object,arraylist,shape
So I have an ArrayList "NamedShape" then i have another ArrayList "Connection" which consists of two fields both being "NamedShape" and i want to add data that i retrieve from the ArrayList "NamedShape" to the ArrayList "Connection" Here is my ArrayList "NamedShape" ArrayList<NamedShape> shapes = new ArrayList<NamedShape>(); public class NamedShape...

Bodies not colliding properly in Box2D(LibGDX)

java,libgdx,box2d,shape
So, in my game I have a box2D dynamic body with a polygon shape as my player and a box2D static body with a chain shape as a static box. The debug renderer is showing all the boxes correctly. When the player collides with the box from the top, it...

How to create an indent in shaped control that allows painting on indented region?

c#,graphics,shape
I have a custom control, which I am applying a shape to. The shape has a pointer (similar to the message indicator in Skype that shows if the message was a received message, or a sent message) that is on the left or right side. When the indicator is on...

Convert Shape into reusable Geometry in WPF

c#,wpf,geometry,custom-controls,shape
I am trying to convert a System.Windows.Shapes.Shape object into a System.Windows.Media.Geometry object. With the Geometry object, I am going to render it multiple times with a custom graph control depending on a set of data points. This requires that each instance of the Geometry object has a unique TranslateTransform object....

How to draw a diamond shape in java?

java,arraylist,geometry,shape,graphics2d
So i have to draw a diamond shape. Not a Static diamond but a diamond that i will myself drag and draw. I've used General Path to do it but it is drawing a diamond that is not straight; the diamond is bend to the left and it's not being...

Measuring the distance between two relative frequency vectors

distance,shape,similarity,euclidean-distance
I am having a problem in choosing a adequate distance function to measure the similarity (dissimilarity) between two relative frequency vectors. More specifically, I am using shape feature vectors that contain data about the basic shapes (circle, triangle, square) present in an image. Thus the vectors are in the form...

Make a view with rectangle shape using xml definitions (drawable) in Android

android,xml,shape
https://drive.google.com/file/d/0B0vP0ppNf8G3MFdBRmF5WkJEZ3c/view?usp=sharing I want to create shape as above. How do you create this using xml?...

Android bottom zig-zag shape

android,shape,drawrectangle,zigzag
I need to achieve below attached image programatically, is there any way? I know how to draw rectangle in layer-list but for the particular zig-zag texture in bottom I don't have any idea Please help me to achieve this shape Thanks in advance...

Change colour of a shape in Java for Android after user input

java,android,xml,colors,shape
I have a simple shape that is stored in rect.xml, and included in an other xml as a 'background' attribute of a 'View'. The two codes are: \res\layout\rect.xml: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/shape" android:shape="rectangle" > <stroke android:width="2dp" android:color="#aaaaff" /> <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" > </padding> <solid android:color="#E6121A" /> <gradient android:startColor="#000000"...

Ensure two random shapes are never near each other or overlapping

c#,wpf,random,position,shape
var random = new Random(); Canvas.SetLeft(rectangle, random.Next((int)(ImageCanvas.Width - 100))); Canvas.SetTop(rectangle, random.Next((int)(ImageCanvas.Height - 100))); return rectangle; So the above code just randomly sets the Top and Left positions of a rectangle that will appear on the canvas. I can easily reuse this code if I want multiple rectangles to appear on...

How can java detect collision of shapes that are stored in an array Java

java,arraylist,collision-detection,collision,shape
So what am trying to do is to enable the user to draw rectangles and detect collisions between rectangles. The rectangles are added into an Array_List shapes: ArrayList<Shape> shapes = new ArrayList<Shape>(); and for the collisions java must go through the ArrayList to detect collisions of shapes. (Any other ways...

How to change the color of animated in android programmiticaly?

android,animation,background,shape
I have shape in res/drawable/back.xml : <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="85dp" android:shape="ring" android:thickness="5dp" android:useLevel="false"> <solid android:color="#FF0000"> </solid> <size android:height="200dp" android:width="200dp"> </size> </shape> This shape set in background on TextView: <TextView android:id="@+id/fullscreen_content" android:layout_width="200dp"...

Can i add other shapes than ellipse2D rectangle2D to “Shape” in Java?

java,arraylist,geometry,shape,graphics2d
I have an Arraylist that saves all shapes. ArrayList<Shape> shapes = new ArrayList<Shape>(); The ArrayList is of type Shape and hence has ellipse, rectangle, line, point. But now I want to draw a triangle and save it into that same ArrayList. Is it possible to do this? I mean can...

How to draw a specific shape in CSS? [closed]

css,draw,shape,css-shapes
I have shape as the image here. I don't how to draw it in CSS. Can any body help me to draw it? thanks...

R boxplot: How to customize the appearance of the box-and-whisker plots (e.g., remove lines or borders, change symbol of outliers)

r,shape,boxplot,appearance,linestyle
Today, I was wondering how to customize the appearance of the box-and-whisker plots. E.g., I wanted to remove the line around the box. However, the problem is, that the border argument changes the color of all lines of the box-and-whisker plots simultaneously. So, if one has the create idea to...

Java Slick2d - how to keep a shape allways inside a window?

java,shape,drag,slick2d
I'm moving a circle across the window by dragging it with the mouse. I'm supposed to make it always inside the window. So by the default, when you drag the circle in a way that your mouse exits the frame, half of the circle will disappear (because it exits the...

AddTextBox in PowerPoint

powerpoint,shape
Assuming slideShape is a reference to a Shapes object, to create a text box in a PPT slide, I can use the following code: slideShape.AddTextBox(Orientation, left, top, width, height) slideShape.AddTextBox.Text = 'ABC-123 Feb 2015 Mike Smith' So far so good. But if I want to break the text in 3...

How to create ring shape drawable in android?

android,shape
with this code I get just a border: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadius="15dp" android:thickness="2dp" android:useLevel="false"> <solid android:color="#4d4d4d" /> </shape> how can I make a ring shape like below image : ...

Button doesn't change its shape in selector

android,xml,button,selector,shape
I'm trying customize outlook of my button. The problem is, that button doesn't want to change its shape. That mean it's still sharp instead oval. button_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@color/green_bright"> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="8dp"/> <stroke android:color="@color/green_primary"/>...

How to reshape a networkx graph in Python?

python,matplotlib,nodes,shape,networkx
So I created a really naive (probably inefficient) way of generating hasse diagrams. Question: I have 4 dimensions... p q r s . I want to display it uniformly (tesseract) but I have no idea how to reshape it. How can one reshape a networkx graph in Python? I've seen...

How to paint permanently on JComponent

java,swing,arraylist,graphics,shape
I'm trying to create a paint application in Java. I have a "canvas" class which extends JComponent. I have an ArrayList of type Shape which holds all the shapes of the entire drawing. Inside the paintComponent() method: Each loop everything gets cleared Every Shape inside the ArrayList gets painted with...

How to create drawable circle with below requirement?

android,xml,drawable,shape
I'm trying create a circular shaped drawable to put as overlay for profile pictures(circular images) I wrote the below code for circular drawable overlay, <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="@color/light_blue_bg" /> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="2dp" android:color="@android:color/white" /> <solid...

Shape with striped background and a triangular cut on top

css,html5,css3,shape,css-shapes
Hello I need to make shape in CSS/HTML5. I pasted it as an image but now I need to make shape like this. Is there any way to do it? I made something with triangles but it doesn't even look close to this. SHAPE: Here is my CSS. #flag {...

How to change shapedrawable color dynamically for TabHost background?

android,android-layout,android-tabhost,drawable,shape
I have a TabHost, where I use a shape xml to make it looks like this: I define the TabHost background this way: private void setTabColor(TabHost tabHost) { try { for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) { tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.strib_tab); } } catch (ClassCastException e) { } } where...

how to make item background and it's shape display together

android,selector,shape
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="oval"> <solid android:color="#996a151f" /> </shape> </item> <item android:drawable="@drawable/ic_temp_oval"> <shape android:cacheColorHint="@android:color/transparent" android:shape="oval"> <solid android:color="#00ffffff" /> <stroke android:width="1sp" android:color="#99a93435" />...

How to create an ArrayList with objects of another ArrayList?

java,arrays,object,arraylist,shape
So I have an ArrayList "NamedShape" ArrayList<NamedShape> shapes = new ArrayList<NamedShape>(); that contains a Shape and a String and what i want is to have another ArrayList "Connection" that will hold two fields but both are "NamedShape". My ArrayList "Connection" will then look like this: Here is my class for...

Android button looks different after rotating to landscape and still after rotating back

android,shape,material-design,layer-list,floating-action-button
I created my button following this tutorial. It looks pretty good. But if I rotate my device screen to landscape, the button looks different. Do you have some idea, why this is happening? If you need some code, please let me know! Button as it should: Button as it after...

Detect custom shape OpenCV

opencv,real-time,shape,detection
I want to find custom shape in OpenCV. Shape is previously defined.I want to detect shape is equal or not equal using WebCam in real time. How can I do that?How to compare pre-defined custom shape and current shape?

SVG positioning dasharray at top

arrays,svg,shape,svg-animate
I would like to get a 'T shape' at the top of the SVG Circle, but cant seem to get it to display correctly. I have the used stroke-dasharray to split the circle up, however I can only get them on the right-hand side, ideally would like to get them...

How to set background image on the right hand side of a shape in android

android,background,android-edittext,shape
I am making a background shape for EditText - xml below: <?xml version="1.0" encoding="UTF-8" ?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="@color/WhiteSmoke"/> <stroke android:width="1dp" android:color="@color/aadhaar_logo_brown" /> <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /> <corners android:topRightRadius="10dp" /> <gradient android:startColor="@color/White" android:centerColor="@color/White"...

Delete one autoshape in a range - VBA

excel,vba,shape
This is what i try to do. When i click on one button, the autoshape above is copied in the A8:F12 rectangle. The code for the 1st button(recorded macro): Sub addTextbox1() Range("A2:C3").Select Range("C2").Activate Selection.Copy Range("B9").Select ActiveSheet.Paste End Sub My problem is i want to make a button which can...