Re: How I can convert this python line to clojure?

2012-06-26 Thread Antonio Recio
@Lars Nilson: You are right, I have take a look 
at vtkDataSetAttributes.java and there is not any reference to SCALARS.

In vtk documentation they have included SCALARS.
http://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html#a156a8842bffd9139fa81193cca0d5bcbaefbcc1c766a1bad6e1e09d5be8388e3d

And you can find SCALARS in the python example
http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Graphics/Python/SingleYoungsMaterialInterface.py

Why is not included SCALARS in the java version? Which could be the 
equivalent in java/clojure?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can convert this python line to clojure?

2012-06-26 Thread Antonio Recio
I would like convert this python line to clojure:
vtkCompositeDataSet.NAME()

When I read vtkCompositeDataSet.java I find this:
  private native long NAME_16();
  public vtkInformationStringKey NAME() {
long temp = NAME_16();

if (temp == 0) return null;
return 
(vtkInformationStringKey)vtkObject.JAVA_OBJECT_MANAGER.getJavaObject(temp);
  }

I have tried in clojure this, but it doesn't work :
user= (println (vtk.vtkCompositeDataSet$Attr/NAME))
#CompilerException java.lang.ClassNotFoundException: 
vtk.vtkCompositeDataSet$Attr, compiling:(REPL:13)

How I can write it in clojure?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can convert this python line to clojure?

2012-06-25 Thread Antonio Recio
@Lars Nilsson: I doesn't work. 

user= (println vtkDataSetAttributes$AttributeTypes/SCALARS)
#CompilerException java.lang.RuntimeException: No such namespace: 
vtkDataSetAttributes$AttributeTypes, compiling:(REPL:4)

user= (println vtk.vtkDataSetAttributes$AttributeTypes/SCALARS)
#CompilerException java.lang.ClassNotFoundException: 
vtk.vtkDataSetAttributes$AttributeTypes, compiling:(REPL:4)

user= (println vtk.vtkDataSetAttributes/SCALARS)
#CompilerException java.lang.RuntimeException: Unable to find static 
field: SCALARS in class vtk.vtkDataSetAttributes, compiling:(REPL:4)

Not sure if you can get the equivalent of 0 as output, but perhaps 
 referring to vtkDataSetAttributes$AttributeTypes/SCALARS will work? 

 Lars Nilsson 


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How to convert a python list to clojure?

2012-06-24 Thread Antonio Recio
I have this list in python:
cc = list()
for i in range(256):
cc.append(ctf.GetColor(float(i) / 255.0))

And I would know if this is correct conversion in clojure?
(def cc
  [(for [i (range 256)]
 (.. ctf GetColor (/ i 255.0)))])

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How I can convert this python line to clojure?

2012-06-24 Thread Antonio Recio

I have this python line that gives the number 1 as result

print vtkDataObject.FIELD_ASSOCIATION_CELLS
;= 1


And I would like to convert it to clojure.I have tried this 3 way, but I 
think they are incorrect. Which is the correct way?

(println (vtkDataSetAttributes.SCALARS))
;= #CompilerException java.lang.ClassNotFoundException: 
vtkDataSetAttributes.SCALARS, compiling:(REPL:6)

(println vtk.vtkDataSetAttributes/SCALARS)
;= #CompilerException java.lang.RuntimeException: Unable to find static 
field: SCALARS in class vtk.vtkDataSetAttributes, compiling:(REPL:8)

(println (vtk.vtkDataSetAttributes/SCALARS))
;= #CompilerException java.lang.NoSuchFieldException: SCALARS, 
compiling:(REPL:11)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can convert this python line to clojure?

2012-06-24 Thread Antonio Recio
The python line that I have rote before is not the one that I want to 
convert. The correct python line is this, and the result is 0. How I can 
convert it to clojure?
print vtkDataSetAttributes.SCALARS
;= 0

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

One little question about vectors and nth?

2012-06-23 Thread Antonio Recio
I have an object called cone. I can change the origin of the cone with this:
(.SetOrigin cone 1 1 1)

I have a vector called v
(def v [2 4 6 8])

And I would like to take 3 elements of the vector v and to set to the 
origin of the cone. But when I write this I obtain an error: 
(.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3)))
;= #ClassCastException java.lang.ClassCastException: Cannot cast 
clojure.lang.PersistentList to [D

What I am doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Little question about doto?

2012-06-23 Thread Antonio Recio
I create a white sphere at the beginning of my code, and later, after some 
lines of code, I change the color and the position of this sphere.

(def sphere (doto (mesh.sphere.)
  (.SetColor white))

(...)
(...)
(...)

(.. sphere SetColor red)
(.. sphere SetPosition 5 5 0))


To change the color and the position I need to repeat sphere each time. 
Is there any way to avoid repeat sphere each time, for example using 
doto?

(def sphere (doto (mesh.sphere.)
  (.SetColor white))

(...)
(...)
(...)

(doto sphere
  (.SetColor red)
  (.SetPosition 5 5 0))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Clojurescript and SQLite?

2012-04-21 Thread Antonio Recio
I would like to write an offline webapp for iphone using clojurescript and 
sqlite. Do you know some project/tutorial to take a look?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-08 Thread Antonio Recio
It works!!! Thanks Aaron Cohen and Mark Rathwell.

The code final that works 100% of the example cone6 of vtk in clojure is 
this:

(ns example
  (:import (javax.swing JFrame JPanel SwingUtilities)))

(clojure.lang.RT/loadLibrary vtkCommonJava)
(clojure.lang.RT/loadLibrary vtkWidgetsJava)

(def boxWidget  (vtk.vtkBoxWidget.))

(def myCallback
  (fn []
(println Invoked!)
(let [t (vtk.vtkTransform.)]
  (doto boxWidget
(.GetTransform t)
(.. GetProp3D (SetUserTransform t))


(defn main []
  (let [cone   (vtk.vtkConeSource.)
coneMapper (vtk.vtkPolyDataMapper.)
coneActor  (vtk.vtkActor.)
ren(vtk.vtkRenderer.)
renWin (vtk.vtkRenderWindow.)
iren   (vtk.vtkRenderWindowInteractor.)
style  (vtk.vtkInteractorStyleTrackballCamera.)
t  (vtk.vtkTransform.)]

(doto cone
  (.SetHeight 3.0)
  (.SetRadius 1.0)
  (.SetResolution 10))
(doto coneMapper
  (.SetInput (.GetOutput cone)))
(doto coneActor
  (.SetMapper coneMapper))
(doto ren
  (.GradientBackgroundOn)
  (.SetBackground 0.5 0.6 0.8)
  (.AddActor coneActor)
  (.ResetCamera))
(doto renWin
  (.AddRenderer ren)
  (.SetSize 300 300))
(doto iren
  (.SetRenderWindow renWin)
  (.SetInteractorStyle style))
(doto boxWidget
  (.SetInteractor iren)
  (.SetPlaceFactor 1.25)
  (.SetProp3D coneActor)
  (.PlaceWidget)
  (.AddObserver InteractionEvent myCallback run)
  (.On))
(doto iren
  (.Initialize)
  (.Start

(example/main)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-07 Thread Antonio Recio
When I print myCallback I obtain this:
(println myCallback)
user = #example$myCallback example$myCallback@6e1c51b4

I have used this:
(doto coneMapper
   (.SetInput (.GetOutput cone)))
And the applications runs, with not errors in the prompt too, but the 
boxWidget still doesn't work.



On Wednesday, March 7, 2012 9:19:38 PM UTC+1, Aaron Cohen wrote:

 Unfortunately, I've been unable to get vtk to compile locally.

 At this point, it's seeming to me that your issue is more vtk-related
 than clojure, though. Can you put a println in the callback to confirm
 that it's at least being called?

 One question, is it significant that your code is slightly different
 from the example here?

 (doto coneMapper
   (.SetInputConnection (.GetOutputPort cone)))

 Although I'm not sure if it's significant, from reading the example
 code, it would be:

  (doto coneMapper
(.SetInput (.GetOutput cone)))



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-07 Thread Antonio Recio
It seems that callback is not called. I have added  (println Testing 
callback) in the definition of myCallback and there is not message in the 
prompt when I run the application.

(def myCallback
  (fn []
(let [t (vtk.vtkTransform.)]
  (.GetTransform t)
  (- boxWidget .GetProp3D (.SetUserTransform t))
  (println Testing callback

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-07 Thread Antonio Recio
You are right. I have capitalized InteractionEvent and now callback it is 
called and it prints invoke.

The application runs but the boxWidget still doesn't work, and I obtain an 
error message:
Exception in thread main java.lang.IllegalArgumentException: No matching 
field found: GetTransform for class vtk.vtkTransform
at clojure.lang.Reflector.getInstanceField(Reflector.java:285)
at 
clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:314)
at example$myCallback.invoke(cone.clj:15)
at clojure.lang.AFn.run(AFn.java:24)
at vtk.vtkRenderWindowInteractor.Start_5(Native Method)
at 
vtk.vtkRenderWindowInteractor.Start(vtkRenderWindowInteractor.java:32)
at example$main.invoke(cone.clj:54)
at example$eval21.invoke(cone.clj:58)
at clojure.lang.Compiler.eval(Compiler.java:6488)
at clojure.lang.Compiler.load(Compiler.java:6929)
at clojure.lang.Compiler.loadFile(Compiler.java:6889)
at clojure.main$load_script.invoke(main.clj:283)
at clojure.main$script_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-05 Thread Antonio Recio
Yes I have tried using fn and I gives me the same error : Exception in 
thread main java.lang.NoSuchMethodError: invoke

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-05 Thread Antonio Recio
I have tried the new code. There are not errors in the prompt, but the 
boxWidget still doesn't work. It seems like boxWidget and the cone are not 
well connected. 

The final code that I have after using run:

(ns example
  (:import (javax.swing JFrame JPanel SwingUtilities)))

(clojure.lang.RT/loadLibrary vtkCommonJava)
(clojure.lang.RT/loadLibrary vtkWidgetsJava)

(def boxWidget  (vtk.vtkBoxWidget.))

(def myCallback
  (fn []
(let [t (vtk.vtkTransform.)]
  (.GetTransform t)
  (- boxWidget .GetProp3D (.SetUserTransform t)

(defn main []
  (let [cone   (vtk.vtkConeSource.)
coneMapper (vtk.vtkPolyDataMapper.)
coneActor  (vtk.vtkActor.)
ren(vtk.vtkRenderer.)
renWin (vtk.vtkRenderWindow.)
iren   (vtk.vtkRenderWindowInteractor.)
style  (vtk.vtkInteractorStyleTrackballCamera.)
t  (vtk.vtkTransform.)]

(doto cone
  (.SetHeight 3.0)
  (.SetRadius 1.0)
  (.SetResolution 10))
(doto coneMapper
  (.SetInputConnection (.GetOutputPort cone)))
(doto coneActor
  (.SetMapper coneMapper))
(doto ren
  (.GradientBackgroundOn)
  (.SetBackground 0.5 0.6 0.8)
  (.AddActor coneActor)
  (.ResetCamera))
(doto renWin
  (.AddRenderer ren)
  (.SetSize 300 300))
(doto iren
  (.SetRenderWindow renWin)
  (.SetInteractorStyle style))
(doto boxWidget
  (.SetInteractor iren)
  (.SetPlaceFactor 1.25)
  (.SetProp3D coneActor)
  (.PlaceWidget)
  (.AddObserver interactionEvent myCallback run)
  (.On))
(doto iren
  (.Initialize)
  (.Start

(example/main)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-04 Thread Antonio Recio
How I can use proxy to set the AddObserver?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-04 Thread Antonio Recio
I obtain this error:
Exception in thread main java.lang.NoSuchMethodError: invoke

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-04 Thread Antonio Recio
This example works if you have installed vtk in your system, but it is not 
possible to re-size the cone using the boxWidget. I have disabled the line 
of AddObserver because it gives an error (Exception in thread main 
java.lang.NoSuchMethodError: invoke). What I am doing wrong?

The source of the example written in java is 
herehttp://www.cmake.org/Wiki/VTK/Examples/Java/Miscellaneous/Cone6

(ns example
  (:use [clojure reflect pprint])
  (:import (javax.swing JFrame JPanel SwingUtilities)))

(clojure.lang.RT/loadLibrary vtkCommonJava)
(clojure.lang.RT/loadLibrary vtkWidgetsJava)

(def boxWidget  (vtk.vtkBoxWidget.))

(def myCallback
  (proxy [clojure.lang.IFn] []
(invoke []
  (let [t (vtk.vtkTransform.)]
(.GetTransform t)
(- boxWidget .GetProp3D (.SetUserTransform t))

(defn main []
  (let [cone   (vtk.vtkConeSource.)
coneMapper (vtk.vtkPolyDataMapper.)
coneActor  (vtk.vtkActor.)
ren(vtk.vtkRenderer.)
renWin (vtk.vtkRenderWindow.)
iren   (vtk.vtkRenderWindowInteractor.)
style  (vtk.vtkInteractorStyleTrackballCamera.)
t  (vtk.vtkTransform.)]

(doto cone
  (.SetHeight 3.0)
  (.SetRadius 1.0)
  (.SetResolution 10))
(doto coneMapper
  (.SetInputConnection (.GetOutputPort cone)))
(doto coneActor
  (.SetMapper coneMapper))
(doto ren
  (.GradientBackgroundOn)
  (.SetBackground 0.5 0.6 0.8)
  (.AddActor coneActor)
  (.ResetCamera))
(doto renWin
  (.AddRenderer ren)
  (.SetSize 300 300))
(doto iren
  (.SetRenderWindow renWin)
  (.SetInteractorStyle style))
(doto boxWidget
  (.SetInteractor iren)
  (.SetPlaceFactor 1.25)
  (.SetProp3D coneActor)
  (.PlaceWidget)
  ;; (.AddObserver interactionEvent myCallback invoke) ;; Exception 
in thread main java.lang.NoSuchMethodError: invoke!!
  (.On))
(doto iren
  (.Initialize)
  (.Start

(example/main)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-04 Thread Antonio Recio
If it is not possible to use AddObserver, how I can use gen-class in this 
example?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How I can use InteractionEvent in clojure?

2012-03-03 Thread Antonio Recio
Any advice?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How I can use InteractionEvent in clojure?

2012-03-02 Thread Antonio Recio
How I can translate this InteractionEvent written for a java example to 
clojure?

void myCallback() {
vtkTransform t = new vtkTransform();
boxWidget.GetTransform(t);
boxWidget.GetProp3D().SetUserTransform(t);}


boxWidget.AddObserver(InteractionEvent, this, myCallback);


http://www.cmake.org/Wiki/VTK/Examples/Java/Miscellaneous/Cone6

http://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Question ActionListener conditional

2011-12-23 Thread Antonio Recio
I am trying to add and to remove an object isoActor when I click the 
button isoButton, but I get an error:
Exception in thread main java.lang.IllegalArgumentException: Don't know 
how to create ISeq from: clojure.lang.Symbol

The code:
(. isoButton addActionListener
 (proxy [ActionListener] []
   (if (. isoButton isSelected)
 (actionPerformed [e] (AddActor isoActor))
   (actionPerformed [e] (RemoveActor isoActor)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Question ActionListener conditional

2011-12-23 Thread Antonio Recio
When I click 2 times the button isoButton I get an error.
(.addActionListener isoButton
(proxy [ActionListener] []
  (actionPerformed []
(if (.isSelected isoButton)
  (println Button is selected)
  (println Button is not selected)

Error:
Exception in thread AWT-EventQueue-0 clojure.lang.ArityException: Wrong 
number of args (2) passed to: user$eval39$fn

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Question about accessing java methods?

2011-12-21 Thread Antonio Recio
Is this correct? Are there other ways to convert this java line in clojure?

Java:
boxWidget.GetProp3D().SetUserTransform(t);

Clojure:
(doto boxWidget (- (GetProp3D.) (.SetUserTransform t)))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: java this keyword ?

2011-12-21 Thread Antonio Recio
I am trying to listen every interaction event that is generated by the 
boxWidget, but I am not able to get the solution

(defn myCallback []
  (let [t (vtk.vtkTransform.)]
(doto boxWidget
  (.GetTransform t)
  (- (.GetProp3D) (.SetUserTransform t))
  )))
(defn listener [] (proxy [Object] []))
(doto boxWidget
  (.AddObserver InteractionEvent listener myCallback)
  (.On)
  )

This is the error that I get:
Exception in thread main java.lang.ClassCastException: 
user$main$myCallback__238 cannot be cast to java.lang.String

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How to use *command-line-args* ?

2011-12-21 Thread Antonio Recio
I am trying to write an application using *command-line-args* to read and 
write images:
(defn read-write-image [input-filename output-filename]
  (let [reader (ImageFileReader.)
writer (ImageFileWriter.)]
(.SetFileName reader input-filename)
(.SetFileName writer output-filename)
(.SetInput writer (.GetOutput reader))
(.Update writer)))
(read-write-image (nth *command-line-args* 2) (nth *command-line-args* 3))

When I write this in the terminal:
clojure read-write-image.clj input.png output.png

I get this error:
Exception in thread main java.lang.IndexOutOfBoundsException

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to use *command-line-args* ?

2011-12-21 Thread Antonio Recio
Solved:
(read-write-image (nth *command-line-args* 0) (nth *command-line-args* 1))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How to get the vector?

2011-12-20 Thread Antonio Recio
When I try to get the position of two variables I get a bizzare code, but 
not the vector. How I can get the vector in the form of position iren [0 0 
0]?

user= (.GetEventPosition iren)
#int[] [I@62114b17

user= (.GetPickPosition picker)
#double[] [D@1aef4504

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

IllegalArgumentException Parameter declaration should be a vector ?

2011-12-20 Thread Antonio Recio
Whith this code:  
  (defn myCallback
  (def t (vtk.vtkTransform.))
  (doto boxWidget
(.GetTransform t)
(- (.GetProp3D) (.SetUserTransform t))
))

I get this error. Why?
IllegalArgumentException Parameter declaration def should be a vector  
clojure.core/assert-valid-fdecl (core.clj:6519)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

java this keyword ?

2011-12-20 Thread Antonio Recio
I would like to convert a java code to clojure that contains the word 
this, but I don't know how to.

Java:
boxWidget.AddObserver(InteractionEvent, this, myCallback);

Clojure:
(doto boxWidget (.AddObserver InteractionEvent this myCallback))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

REPL limitation lines to paste?

2011-12-19 Thread Antonio Recio
I have noticed that there is a limit in the lines that be are able to paste 
in REPL. For example when I try to paste 200 lines of clojure code in REPL, 
it only paste the first 92 lines. 
Is it a bug or express? Is it possible to be able to paste unlimited?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

UnsatisfiedLinkError using clojure.lang.RT/loadLibrary

2011-12-17 Thread Antonio Recio
When I try to load native libraries in the System ClassLoader I get an 
error of cannot open shared object file, and I don't know how to solve it.

In linux in REPL :
clojure java -Djava.library.path=/usr/local/lib/vtk-5.9/ -cp 
/usr/share/java/clojure.jar:/usr/local/lib/vtk-5.9/java/vtk.jar clojure.main

when I execute this code :
(ns project.core
  (:import (javax.swing JButton JFrame JPanel)
   (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
vtkInteractorStyleTrackballCamera)))

(clojure.lang.RT/loadLibrary vtkCommonJava)

I obtain this error :
UnsatisfiedLinkError /usr/local/lib/vtk-5.9/libvtkCommonJava.so.5.9.0: 
libvtkCommon.so.5.9: cannot open shared object file: No such file or 
directory  java.lang.ClassLoader$NativeLibrary.load (ClassLoader.java:-2)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Read linux PATH in clojure

2011-12-17 Thread Antonio Recio
Using the environment variable: export VTK_DATA_ROOT=/opt/apps/VTK/VTKData/

I would like to change this:
(.SetFilePrefix /opt/apps/VTK/VTKData/Data/headsq/quarter)

To something like this
(.SetFilePrefix $VTK_DATA_ROOT/Data/headsq/quarter)

How I can write linux PATH in clojure?
  

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Error converting an example written in C++, TCL, python to clojure

2011-12-17 Thread Antonio Recio
I would like to set up an initial centered view of a volume. I have 
different examples without errors of how to do it in c++, tcl and python. 
When I tried to translate in clojure I get errors. Where is the error in my 
clojure code?

In C++ is as follow:
  ren-AddViewProp(volume);
  vtkCamera *camera = ren-GetActiveCamera();
  double *c = volume-GetCenter();
  camera-SetFocalPoint(c[0], c[1], c[2]);
  camera-SetPosition(c[0] + 400, c[1], c[2]);
  camera-SetViewUp(0, 0, -1);

In TCL:
ren AddViewProp volume
set camera [ren GetActiveCamera]
set c [volume GetCenter]
$camera SetFocalPoint [lindex $c 0] [lindex $c 1] [lindex $c 2]
$camera SetPosition [expr [lindex $c 0] + 400] [lindex $c 1] [lindex $c 2]
$camera SetViewUp 0 0 -1

In Python:
ren.AddViewProp(volume)
camera =  ren.GetActiveCamera()
c = volume.GetCenter()
camera.SetFocalPoint(c[0], c[1], c[2])
camera.SetPosition(c[0] + 400, c[1], c[2])
camera.SetViewUp(0, 0, -1)

And this what I have written in Clojure (with errors):
ren (doto (vtkRenderer.)
  (.AddViewProp volume)
  (- (.GetActiveCamera) (.SetFocalPoint (.GetCenter volume 0 1 
2)))
  (- (.GetActiveCamera) (.SetPosition (.GetCenter volume 0 1 
2)))
  (- (.GetActiveCamera) (.SetViewUp 0 0 -1))
  )

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Read linux PATH in clojure

2011-12-17 Thread Antonio Recio
Although in REPL the path is correct, when I execute the application it 
doesn't work. Why?

(.SetFilePrefix (str (get (System/getenv) VTK_DATA_ROOT) 
Data/headsq/quarter))
(.SetFilePrefix /opt/apps/VTK/VTKData/Data/headsq/quarter)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Read linux PATH in clojure

2011-12-17 Thread Antonio Recio
Sorry, I have reexecuted the code above an it works perfectly. Thanks Andy 
Fingerhut.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

ClojureScript and CouchDB?

2011-11-06 Thread Antonio Recio
I would like to use ClojureScript to interact with databases. 
Which is the database engine that you recommend me to use with 
ClojureScript? 
Is CouchDB most recommendable than PostgreSQL? 
Do you know some project using ClojureScript to interact with databases?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Too many arguments to if

2011-07-11 Thread Antonio Recio
I get the error Too many arguments to if with this. Do you have any 
suggestion?

(defn make-tree [tree [n1 n2 n3 n4]]
  (.addItem tree n1)
  (if (empty? n2)
(.setChildrenAllowed tree n1 false)
(doto tree
  (.addItem n2)
  (.setParent n2 n1)
  (.expandItemsRecursively n1))
(if (empty? n3)
  (.setChildrenAllowed tree n2 false)
  (doto tree
(.addItem n3)
(.setParent n3 n2)
(.expandItemsRecursively n2))
  (if (empty? n4)
(.setChildrenAllowed tree n3 false)
(doto tree
  (.addItem n4)
  (.setParent n4 n3)
  (.expandItemsRecursively n3)
  (.setChildrenAllowed n4 false)
  tree)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-07-11 Thread Antonio Recio
Harsha Sanjeewa has translated the vaadin example of the tree in clojure. 
The source is here https://github.com/hsenid-mobile/clj-vaadin. It is very 
useful to begin working with clojure and vaadin. 

This tree example has 2 levels and I would like to have 4 levels. With the 
following code it shows still the 2 levels, although the levels 3 and 4 are 
parented. Why is there no level 3 and 4?

(defn level1 [tree [n1 n2 n3 n4]]
  (.addItem tree n1)
  (if (empty? n2)
(.setChildrenAllowed tree n1 false)
(do
  (reduce
(fn [tree n2]
  (doto tree
(.addItem n2)
(.setParent n2 n1)))
tree n2)
  (.expandItemsRecursively tree n1)
  (if (empty? n3)
(.setChildrenAllowed tree n2 false)
(do
  (reduce
(fn [tree n3]
  (doto tree
(.addItem n3)
(.setParent n3 n2)))
tree n3)
  (.expandItemsRecursively tree n2)
  (if (empty? n4)
(.setChildrenAllowed tree n3 false)
(do (doto tree
  (.addItem n4)
  (.setParent n4 n3)
  (.expandItemsRecursively n3)
  (.setChildrenAllowed n4 false)
  )))
  tree) 

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

I cannot scroll up down REPL in konsole

2011-07-06 Thread Antonio Recio
In the default terminal of KDE linux, konsole, when I am using REPL I 
cannot scroll up down. When I get a long message I can only read the last 
lines. Is there any way to scroll up down the REPL in konsole (or other 
linux terminal)? (I think it is possible in emacs or vim, but I am 
interested in konsole.)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: I cannot scroll up down REPL in konsole

2011-07-06 Thread Antonio Recio
With xterm works fine. 
Are other people with konsole?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: I cannot scroll up down REPL in konsole

2011-07-06 Thread Antonio Recio
I have discovered the cause of the problem, it is screen. When I am using 
repl with screen I cannot scroll up down with konsole or xterm. Without 
screen works fine in konsole or xterm. 

Is there other people with problem with screen and scroll down up repl?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: I cannot scroll up down REPL in konsole

2011-07-06 Thread Antonio Recio
I am using a vim script called 
Viclehttp://www.vim.org/scripts/script.php?script_id=2551to send lines to 
screen repl. This is the reason why I use screen.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: I cannot scroll up down REPL in konsole

2011-07-06 Thread Antonio Recio
@Perry: You are right, when screen is in copy mode (Ctrl + a + [) the 
scrollback works. Solved. Thanks.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

iterate?

2011-07-04 Thread Antonio Recio
Do you know how to solve this?

(= (repeat 100 :foo)
 (take 100 (iterate ___ :foo)))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: lein repl syntax highlighting?

2011-07-03 Thread Antonio Recio
And do you know if with cake is possible to highlight syntax?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Clojure Koans and others interactive exercises to learn clojure?

2011-07-03 Thread Antonio Recio
Clojure koans https://github.com/functional-koans/clojure-koans is awesome 
to learn clojure. Do you know other projects with exercises to learn 
clojure?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Sample Vaadin application in Clojure

2011-07-02 Thread Antonio Recio
The clj-vaadin https://github.com/hsenid-mobile/clj-vaadin project is 
wonderful, it is very useful for me. It has an example of making a tree with 
vaadin with 2 levels. Do you know how I can add a third and fourth level?

(defn level2 [tree n1 n2]
  (reduce (fn [tree n2]
(doto tree
  (.addItem n2)
  (.setParent n2 n1)
  (.setChildrenAllowed n2 false)))
  tree n2))

(defn level1 [tree [n1 n2]]
  (.addItem tree n1)
  (if (empty? n2)
(.setChildrenAllowed tree n1 false)
(do
  (level2 tree n1 n2)
  (.expandItemsRecursively tree n1)))
  tree)

(defn nomina-tree []
  (let [tree (Tree. Index book)]
(reduce level1 tree index)))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

lein repl syntax highlighting?

2011-07-02 Thread Antonio Recio
Is there any way to highlight syntax in lein repl from a terminal?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Other way to express (((m2) 2) 1)?

2011-06-29 Thread Antonio Recio
Is there other way to express (((m2) 2) 1)?

(def m [1 2 [21 22 [221 222 223] 23] 3])
(((m 2) 2) 1)
;- 222

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Antonio Recio
(get-in m [2 2 1]) is great! Which are the others ones? Is there something 
like (- m [2 2 1])?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: struct sharing same key?

2011-06-27 Thread Antonio Recio
When I repeat : the number 3 [{:3 father Andrew D :3 mother Lisa D}] I 
get an error, although I can repeat number 1 with no problem. Why?

(struct person
{:1 english person
 [{:2 Andrew D
   [{:3 father Andrew D
 :3 mother Lisa D}]
   :2 Justin M
   [{:3 Elisa M}]}]
 :1 chinese person
 [{:2 Chi chi}]
 })

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-06-27 Thread Antonio Recio
I have tried to use amap but I was too difficult for me and I have tried the 
map:
  (def tree (com.vaadin.ui.Tree. Planets))
  (map #(.addItem tree (.toString (first %))) planets)

But I get an error: 
IllegalArgumentException Don't know how to create ISeq from: 
clojure.lang.PersistentStructMap$Def  clojure.lang.RT.seqFrom (RT.java:487)

I have a tree with 5 siblevels and I need something like this java code.
for (int i=0; iplanets.length; i++) {
  String planet = (String) (planets[i][0]);
  tree.addItem(planet);
  if (planets[i].length == 1) {
tree.setChildrenAllowed(planet, false);
  } else {
for (int j=1; jplanets[i].length; j++) {
  String moon = (String) planets[i][j];
  tree.addItem(6);
  tree.setParent(6 5);
  tree.setChildrenAllowed(6 false);
}
tree.expandItemsRecursively(planet);
  }
}

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Tree vaadin?

2011-06-26 Thread Antonio Recio
I would like to translate a java example of tree vaadin to clojure. I have 
to files in the same folder: planets.clj and core.clj. I am having problems 
and I need help. What I am doing wrong?
*
*
*;; In the file planets.clj:*
(ns project.planets)
(let [planets (doto (Object.)
  (Object. [Venus])
  (Object. [Earth The Moon])
  (Object. [Mars Phobos Deimos])
  )]

*;; In the file core.clj:*
(load planets)
(defn -cjinit [][[] (ref {})])
(defn -init [this]
  (let [tree (doto (com.vaadin.ui.Tree. The Planets and Major Moons)
   (loop [i 0]
 (str planet planets[i] 0)
 (.addItem planet)
 (if (= planets[i].length 1)
   (.setChildrenAllowed planet false))
 (loop [j 1]
   (str moon planets[i][j])
   (.addItem monn)
   (.setParent moon planet)
   (.setChildrenAllowed moon false))
 (.expandItemsRecursively planet)
 (recur (inc i]
(do (.addComponent main tree


*;; Java*
final Object[][] planets = new Object[][]{
  new Object[]{Mercury},
  new Object[]{Venus},
  new Object[]{Earth, The Moon},
  new Object[]{Mars, Phobos, Deimos},
  new Object[]{Jupiter, Io, Europa, Ganymedes,
Callisto},
  new Object[]{Saturn,  Titan, Tethys, Dione,
Rhea, Iapetus},
  new Object[]{Uranus,  Miranda, Ariel, Umbriel,
Titania, Oberon},
  new Object[]{Neptune, Triton, Proteus, Nereid,
Larissa}};
Tree tree = new Tree(The Planets and Major Moons);
for (int i=0; iplanets.length; i++) {
  String planet = (String) (planets[i][0]);
  tree.addItem(planet);
  if (planets[i].length == 1) {
tree.setChildrenAllowed(planet, false);
  } else {
for (int j=1; jplanets[i].length; j++) {
  String moon = (String) planets[i][j];
  tree.addItem(moon);
  tree.setParent(moon, planet);
  tree.setChildrenAllowed(moon, false);
}
tree.expandItemsRecursively(planet);
  }
}
main.addComponent(tree);
*
*
*;; The final result must be something like this:*

http://vaadin.com/download/current/docs/book/img/components/tree-example1.png

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
*Could* it *possible* to use a list with peek and pop to create the planets 
and moons list?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
Could anyone write the planet array of objects?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
I could be fine this?
(def planets (object-array [[Venus] [Earth The Moon] [Mars Phobos 
Deimos]]))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
How I can translate this in clojure?

for (int i=0; iplanets.length; i++) {
  String planet = (String) (planets[i][0]);
  tree.addItem(planet);

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

struct sharing same key?

2011-06-26 Thread Antonio Recio
I would like to create an struct with the names of differents nationalities. 
When people are the same nationality I would don't need to repeat again the 
nationality. Is there any way t0 get that. For example, I would like to 
write something like that:

(defstruct person :nationality :first :last)

(def people (struct person  english Jim
 Silvester
 Stephen Howards
   chinese Chiu Chiu))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

table vaadin?

2011-06-25 Thread Antonio Recio
I am having problems to translate this table vaadin in java to clojure:

;; Java
Table table = new Table(This is my Table);
table.addContainerProperty(First Name, String.class,  null);
table.addContainerProperty(Last Name,  String.class,  null);
table.addContainerProperty(Year,   Integer.class, null);
table.addItem(new Object[] {
Nicolaus,Copernicus,new Integer(1473)}, new Integer(1));
table.addItem(new Object[] {
Tycho,   Brahe, new Integer(1546)}, new Integer(2));

;; Clojure
table (doto (.Table)
 (.addContainerProperty First Name String.class null)
 (.addContainerProperty Last Name String.class null)
 (.addContainerProperty Year Integer.class null)
 (.addItem Object. [Nicolaus Copernicus 1473 1])
 (.addItem Object. [Tycho Brahe 1546 2])

The result is something like this:
http://vaadin.com/download/current/docs/book/img/components/table-example1.png

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: table vaadin?

2011-06-25 Thread Antonio Recio
It seems there is some error importing com.vaadin.ui.Table. What does it 
mean cannot be cast to clojure.lang.IFn? How I can solve it?
*
*
*exception*

javax.servlet.ServletException: java.lang.ClassCastException: 
com.vaadin.ui.Table cannot be cast to clojure.lang.IFn

*root cause*

java.lang.ClassCastException: com.vaadin.ui.Table cannot be cast to 
clojure.lang.IFn

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Conversion of one java example to clojure?

2011-06-24 Thread Antonio Recio
I am newbie. Could be better like this? 

(def brownFox The quick brown fox jumps over the lazy dog.)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Optimize .addComponent?

2011-06-23 Thread Antonio Recio
I would like to use only one time .addComponent and don't repeat it each 
time that I need to add something. How I can do it? Perhaps with doto? Are 
there other way? It is possible to optimize it more?

(defn -init [this]
  (let [app this]
(.setMainWindow this
  (doto (Window. Test application)
(.addComponent (Label. Hello!))
(.addComponent (Button. button))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Optimize .addComponent?

2011-06-23 Thread Antonio Recio
I obtain an error:

javax.servlet.ServletException: java.lang.IllegalArgumentException: Wrong 
number of args (3) passed to: vapp$add-components-BANG-

java.lang.IllegalArgumentException: Wrong number of args (3) passed to: 
vapp$add-components-BANG-

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

getMethods

2011-06-23 Thread Antonio Recio
I have found a function to get the methods of the classes in the book The 
Joy of Clojure, and I would like to use it in REPL. Instead of 
java.awt.Frame I would like to specify the library that I want writing 
something like (methods any.library). Which is the way to get it?

(for [method (seq (.getMethods java.awt.Frame)) :let [method-name (.getName 
method)]] method-name)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Conversion of one java example to clojure?

2011-06-23 Thread Antonio Recio
I have tried to translate an example of vaadin in java to clojure. But I get 
errors.

This is the java code:
Panel panel = new Panel(Split Panels Inside This Panel);
HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
panel.setContent(hsplit);
Tree tree = new Tree(Menu, TreeExample.createTreeContent());
hsplit.setFirstComponent(tree);
VerticalSplitPanel vsplit = new VerticalSplitPanel();
hsplit.setSecondComponent(vsplit);
vsplit.addComponent(new Label(Here's the upper panel));
vsplit.addComponent(new Buton(Here's the lower panel));

And this the clojure code. Where I am doing wrong?
(defn -init [this]
  (let [app this]
(.setMainWindow this
  (doto (Window. Test application)
(add
  (panel (doto (Panel. Split panels inside this panel)
   (.setContent hsplit)))
  (hsplit (doto (HorizontalSplitPanel.)
(.setFirstComponent tree)
(.setSecondComponent vsplit)))
  (tree Tree. Menu)
  (vsplit VerticalSplitPanel.
  (add (Label. upper panel) (Button. lower panel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Conversion of one java example to clojure?

2011-06-23 Thread Antonio Recio
There are not window in the java code, anyway I have added it in the clojure 
code (could be deleted).

The window java code could be something like this:
setMainWindow(new Window(Test application));

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Conversion of one java example to clojure?

2011-06-23 Thread Antonio Recio
Before I have forgotten to post the source of the function add 
(https://groups.google.com/d/topic/clojure/N1wmlOrGYj0/discussion):

(defn add [composite  components]
Avoid repetition of .addComponent
Instead of (doto (Window. \foo\) (.addComponent (Label. \bar\)) 
(.addComponent (Button. \button\)))
you can use (doto (Window. \foo\) (add (Label. \bar\) (Button. 
\button\)))
  (doseq [component components] (.addComponent composite component)))


I would like to post a complete example of vaadin in java 
(http://demo.vaadin.com/sampler/#SplitPanelBasic) and the translation in 
clojure that I have done, and to know your opinion.


;; JAVA :

import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.VerticalSplitPanel;

@SuppressWarnings(serial)
public class SplitPanelBasicExample extends VerticalLayout {

public static final String brownFox = The quick brown fox jumps over 
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown 
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over 
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown 
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over 
the lazy dog. The quick brown fox jumps over the lazy dog. ;

public SplitPanelBasicExample() {
// First a vertical SplitPanel
final VerticalSplitPanel vert = new VerticalSplitPanel();
vert.setHeight(450px);
vert.setWidth(100%);
vert.setSplitPosition(150, Sizeable.UNITS_PIXELS);
addComponent(vert);

// add a label to the upper area
vert.addComponent(new Label(brownFox));

// Add a horizontal SplitPanel to the lower area
final HorizontalSplitPanel horiz = new HorizontalSplitPanel();
horiz.setSplitPosition(50); // percent
vert.addComponent(horiz);

// left component:
horiz.addComponent(new Label(brownFox));

// right component:
horiz.addComponent(new Label(brownFox));

// Lock toggle button
CheckBox toggleLocked = new CheckBox(Splits locked,
new Button.ClickListener() {
// inline click.listener
public void buttonClick(ClickEvent event) {
vert.setLocked(event.getButton().booleanValue());
horiz.setLocked(event.getButton().booleanValue());
}
});
toggleLocked.setImmediate(true);
addComponent(toggleLocked);

}
}


;; CLOJURE :

(ns project.vapp
  (:gen-class
:extends com.vaadin.Application
:name example.VApp
:init cjinit)
  (:import (com.vaadin.ui CheckBox HorizontalSplitPanel Label VerticalLayout 
VerticalSplitPanel)
   (com.vaadin.terminal Sizeable)))

(defn -cjinit []
  [[] (ref {})])

(defn add [composite  components]
Avoid repetition of .addComponent
Instead of (doto (Window. \foo\) (.addComponent (Label. \bar\)) 
(.addComponent (Button. \button\)))
you can use (doto (Window. \foo\) (add (Label. \bar\) (Button. 
\button\)))
  (doseq [component components] (.addComponent composite component)))

(def brownFox (fn [] The quick brown fox jumps over the lazy dog. The quick 
brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy 
dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps 
over the lazy dog. The quick brown fox jumps over the lazy dog. The quick 
brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy 
dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps 
over the lazy dog. The quick brown fox jumps over the lazy dog. The quick 
brown fox jumps over the lazy dog. )) 

(defn -init [this]
  (let [app this]
(vert (doto (VerticalSplitPanel.)
(.setHeight 450px)
(.setWidht 100%)
(.setSplitPosition (150 Sizeable.UNITS_PIXELS))
(add (Label. brownFox) (horiz
(add vert)
(horiz (doto (HorizontalSplitPanel.)
 (.setSplitPosition 50)
 (add (Label. brownFox))   ; Left component
 (add (Label. brownFox ; Right component
(toggleLocked (doto (CheckBox. Split locked)
(.addListener
   (proxy [com.vaadin.ui.Button$ClickListener] []
 (buttonClick [event]
   (.setLocked(- (event.getButton) (.booleanValue)) 
vert)
   (.setLocked(- (event.getButton) (.booleanValue)) 
horiz
(.setImmediate true)))
(add toggleLocked)))

-- 
You received this message because you 

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
I have tried to use wall-hack-method but I still obtain the 
error: UnsatisfiedLinkError vtk.vtkConeSource.VTKInit()J 
 vtk.vtkConeSource.VTKInit (vtkConeSource.java:-2). What I am doing wrong?

(ns project.core
  (:import (javax.swing JButton JFrame JPanel)
   (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
vtkInteractorStyleTrackballCamera)))

(System/loadLibrary vtkCommonJava)
(System/loadLibrary vtkFilteringJava)
(System/loadLibrary vtkIOJava)
(System/loadLibrary vtkImagingJava)
(System/loadLibrary vtkGraphicsJava)
(System/loadLibrary vtkRenderingJava)

(defn wall-hack-method
  [class-name method-name params obj  args]
  (- class-name (.getDeclaredMethod (name method-name) (into-array Class 
params))
(doto (.setAccessible true))
(.invoke obj (into-array Object args

(defn load-lib [class vtk]
(wall-hack-method java.lang.Runtime vtkCommonJava [Class String]
(Runtime/getRuntime) class vtk))

(load-lib vtkConeSource vtkCommonJava)

(defn main []
  (let [cone (doto (vtkConeSource.)
   (.SetHeight 3.0)
   (.SetRadius 1.0)
   (.SetResolution 10))
coneMapper (doto (vtkPolyDataMapper.)
 (.SetInputConnection(.GetOutputPort cone)))
coneActor (doto (vtkActor.)
(.SetMapper coneMapper))
ren (doto (vtkRenderer.)
  (.AddActor coneActor)
  (.SetBackground 0.1 0.2 0.4)
  (.ResetCamera)
  (- (.GetActiveCamera) (.Azimuth 90)))
renWin (doto (vtkRenderWindow.)
 (.AddRenderer ren)
 (.SetSize 300 300))
iren (doto (vtkRenderWindowInteractor.)
   (.SetRenderWindow renWin)
   (.SetInteractorStyle (vtkInteractorStyleTrackballCamera.))
   (.Initialize)
   (.Start))
]))

(project.core/main)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
Aaron Cohen, thank you! It works !!!

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
I have tried to convert the example Cone5.java from VTK to clojure. I have 
write this ... but it doesn't work. Do you have any suggestion?


*The original java:*

import vtk.*;

public class Cone5 {
  static { 
System.loadLibrary(vtkCommonJava); 
System.loadLibrary(vtkFilteringJava); 
System.loadLibrary(vtkIOJava); 
System.loadLibrary(vtkImagingJava); 
System.loadLibrary(vtkGraphicsJava); 
System.loadLibrary(vtkRenderingJava); 
  }

  public static void main (String []args) throws Exception {
vtkConeSource cone = new vtkConeSource();
cone.SetHeight( 3.0 );
cone.SetRadius( 1.0 );
cone.SetResolution( 10 );

vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
coneMapper.SetInputConnection(cone.GetOutputPort());

vtkActor coneActor = new vtkActor();
coneActor.SetMapper(coneMapper);

vtkRenderer ren1 = new vtkRenderer();
ren1.AddActor(coneActor);
ren1.SetBackground(0.1, 0.2, 0.4);

vtkRenderWindow renWin = new vtkRenderWindow();
renWin.AddRenderer( ren1 );
renWin.SetSize(300, 300);

ren1.ResetCamera();
ren1.GetActiveCamera().Azimuth(90);

vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow(renWin);

vtkInteractorStyleTrackballCamera style = 
new vtkInteractorStyleTrackballCamera();
iren.SetInteractorStyle(style);


iren.Initialize();
iren.Start();
  }
}

*
My modified version in clojure with errors:*

(ns project.core
  (:import (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
vtkInteractorStyleTrackballCamera)))

(defn main []
  (let [cone (doto (vtkConeSource.)
   (.SetHeight 3.0)
   (.SetRadius 1.0)
   (.SetResolution 10))
coneMapper (doto (vtkPolyDataMapper.)
 (.SetInputConnection(.GetOutputPort cone)))
coneActor (doto (vtkActor.)
(.SetMapper coneMapper))
ren (doto (vtkRenderer.)
  (.AddActor coneActor)
  (.SetBackground 0.1 0.2 0.4)
  (.ResetCamera)
  (.GetActiveCamera.Azimuth 90))
renWin (doto (vtkRenderWindow.)
 (.AddRenderer ren)
 (.SetSize 300 300))
iren (doto (.vtkRenderWindowInteractor.)
   (.SetRenderWindow renWin)
   (.SetInteractorStyle vtkInteractorStyleTrackballCamera.)
   (.Initialize)
   (.Start))
]))

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
*After the corrections I have this:
*
(ns project.core
  (:import (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
vtkInteractorStyleTrackballCamera)))

(defn main []
  (let [cone (doto (vtkConeSource.)
   (.SetHeight 3.0)
   (.SetRadius 1.0)
   (.SetResolution 10))
coneMapper (doto (vtkPolyDataMapper.)
 (.SetInputConnection(.GetOutputPort cone)))
coneActor (doto (vtkActor.)
(.SetMapper coneMapper))
ren (doto (vtkRenderer.)
  (.AddActor coneActor)
  (.SetBackground 0.1 0.2 0.4)
  (.ResetCamera)
  (- (.GetActiveCamera) (.Azimuth 90)))
renWin (doto (vtkRenderWindow.)
 (.AddRenderer ren)
 (.SetSize 300 300))
iren (doto (vtkRenderWindowInteractor.)
   (.SetRenderWindow renWin)
   (.SetInteractorStyle (vtkInteractorStyleTrackballCamera.))
   (.Initialize)
   (.Start))
]))


*But in the REPL I obtain this error.*

user= (main)
UnsatisfiedLinkError vtk.vtkConeSource.VTKInit()J  vtk.vtkConeSource.VTKInit 
(vtkConeSource.java:-2)


*I can view any gui, do you think that I need to use java swing JFrame 
JPanel?*

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
I have added the static libraries in the clojure file:

(ns project.core
  (:import (javax.swing JButton JFrame JPanel)
   (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
vtkInteractorStyleTrackballCamera)))

(System/loadLibrary vtkCommonJava)
(System/loadLibrary vtkFilteringJava)
(System/loadLibrary vtkIOJava)
(System/loadLibrary vtkImagingJava)
(System/loadLibrary vtkGraphicsJava)
(System/loadLibrary vtkRenderingJava)

(defn main []
  (let [cone (doto (vtkConeSource.)
   (.SetHeight 3.0)
   (.SetRadius 1.0)
   (.SetResolution 10))
coneMapper (doto (vtkPolyDataMapper.)
 (.SetInputConnection(.GetOutputPort cone)))
coneActor (doto (vtkActor.)
(.SetMapper coneMapper))
ren (doto (vtkRenderer.)
  (.AddActor coneActor)
  (.SetBackground 0.1 0.2 0.4)
  (.ResetCamera)
  (- (.GetActiveCamera) (.Azimuth 90)))
renWin (doto (vtkRenderWindow.)
 (.AddRenderer ren)
 (.SetSize 300 300))
iren (doto (vtkRenderWindowInteractor.)
   (.SetRenderWindow renWin)
   (.SetInteractorStyle (vtkInteractorStyleTrackballCamera.))
   (.Initialize)
   (.Start))
]))

(project.core/main)

But I still get the same error. I think that I have problems to add the 
LD_LIBRARY_PATH to my REPL.
user = (project.core/main)
UnsatisfiedLinkError vtk.vtkConeSource.VTKInit()J  vtk.vtkConeSource.VTKInit 
(vtkConeSource.java:-2)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
I have tried with ... but I get the same error:

(System/setProperty java.library.path /usr/local/lib/vtk-5.9/)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
I have tried also this:

$ java -Djava.library.path=/usr/local/lib/vtk-5.9/ 
-Djava.ext.dirs=/usr/share/java -cp clojure.jar:src clojure.main main.clj

Exception in thread main java.lang.ClassNotFoundException: 
vtk.vtkConeSource (main.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.load(Compiler.java:5857)
at clojure.lang.Compiler.loadFile(Compiler.java:5820)
at clojure.main$load_script.invoke(main.clj:221)
at clojure.main$script_opt.invoke(main.clj:273)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:409)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.ClassNotFoundException: vtk.vtkConeSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at 
clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:58)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at project.core$eval3$loading__4410__auto4.invoke(main.clj:1)
at project.core$eval3.invoke(main.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
Aaron, thanks. You are right I had forgotten the vtk.jar, but I still obtain 
errors:

*My /usr/local/bin/clojure:*

#!/bin/sh
export JAVA_HOME=/usr/lib/jvm/java-6-sun/
export 
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/:/usr/local/lib/:/usr/local/lib/vtk-5.9/:/usr/local/lib/cmake/ITK-4.0/WrapITK/lib/
export 
CLASSPATH=/usr/share/java/clojure-contrib.jar:/usr/local/lib/vtk-5.9/java/vtk.jar:.

if [ x$CLASSPATH = x ] ; then
extra_classpath=
else
extra_classpath=:$CLASSPATH
fi

while true ; do
case $1 in
-cp | -classpath)
extra_classpath=:$2
shift 2 ;;
--)
shift
break ;;
*)
break ;;
esac
done

if [ x$1 = x -a x`which rlwrap` != x ] ; then
rlwrap=rlwrap -r -c -C clojure -f /etc/rlwrap/clojure-b 
(){}[],^%\$#@\\;:''|\\
fi

exec rlwrap --complete-filenames --quote-characters='' --prompt-colour=Red 
java -cp /usr/share/java/clojure.jar$extra_classpath clojure.main $@



*When I execute the application:*

$ clojure main.clj

Exception in thread main java.lang.RuntimeException: 
java.lang.UnsatisfiedLinkError: vtk.vtkConeSource.VTKInit()J
at clojure.lang.Util.runtimeException(Util.java:153)
at clojure.lang.Compiler.eval(Compiler.java:6417)
at clojure.lang.Compiler.load(Compiler.java:6843)
at clojure.lang.Compiler.loadFile(Compiler.java:6804)
at clojure.main$load_script.invoke(main.clj:282)
at clojure.main$script_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:401)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
Caused by: java.lang.UnsatisfiedLinkError: vtk.vtkConeSource.VTKInit()J
at vtk.vtkConeSource.VTKInit(Native Method)
at vtk.vtkObject.init(vtkObject.java:96)
at vtk.vtkAlgorithm.init(vtkAlgorithm.java:794)
at vtk.vtkPolyDataAlgorithm.init(vtkPolyDataAlgorithm.java:163)
at vtk.vtkConeSource.init(vtkConeSource.java:114)
at project.core$main.invoke(main.clj:14)
at project.core$eval26.invoke(main.clj:38)
at clojure.lang.Compiler.eval(Compiler.java:6406)
... 10 more

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
java -Djava.library.path=/usr/local/lib/vtk-5.9/ -cp 
/usr/share/java/clojure.jar:/usr/local/lib/vtk-5.9/java/vtk.jar clojure.main 
main.clj

Exception in thread main java.lang.RuntimeException: 
java.lang.UnsatisfiedLinkError: vtk.vtkConeSource.VTKInit()J
at clojure.lang.Util.runtimeException(Util.java:153)
at clojure.lang.Compiler.eval(Compiler.java:6417)
at clojure.lang.Compiler.load(Compiler.java:6843)
at clojure.lang.Compiler.loadFile(Compiler.java:6804)
at clojure.main$load_script.invoke(main.clj:282)
at clojure.main$script_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:401)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
Caused by: java.lang.UnsatisfiedLinkError: vtk.vtkConeSource.VTKInit()J
at vtk.vtkConeSource.VTKInit(Native Method)
at vtk.vtkObject.init(vtkObject.java:96)
at vtk.vtkAlgorithm.init(vtkAlgorithm.java:794)
at vtk.vtkPolyDataAlgorithm.init(vtkPolyDataAlgorithm.java:163)
at vtk.vtkConeSource.init(vtkConeSource.java:114)
at project.core$main.invoke(main.clj:14)
at project.core$eval26.invoke(main.clj:38)
at clojure.lang.Compiler.eval(Compiler.java:6406)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: How to convert a VTK example from java to clojure?

2011-06-21 Thread Antonio Recio
All the vtk libraries that I need are in /usr/local/lib/vtk-5.9/ and are 
executable.
Java and c++ examples work fine.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en