1 /***********************************************************************/
2 /* Open Visualization Data Explorer */
3 /* (C) Copyright IBM Corp. 1989,1999 */
4 /* ALL RIGHTS RESERVED */
5 /* This code licensed under the */
6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
7 /***********************************************************************/
8
9 #include <dxconfig.h>
10
11
12 /*
13 * $Header: /src/master/dx/src/exec/dxmods/_refine.c,v 1.4 2000/08/24 20:04:18 davidt Exp $
14 */
15
16 #include <string.h>
17 #include "math.h"
18 #include <dx/dx.h>
19 #include "_refine.h"
20
21 static Field RefineField(Field, char *, int);
22
23 typedef struct
24 {
25 int limit;
26 } Args;
27
28 Object
_dxfRefine(Object object,int limit)29 _dxfRefine(Object object, int limit)
30 {
31 Args args;
32 Object result;
33
34 args.limit = limit;
35
36 result = DXProcessParts
37 (object, RefineField, (char *)&args, sizeof(args), 1, 0);
38
39 return result;
40 }
41
42 static Field
RefineField(Field field,char * args,int l)43 RefineField(Field field, char *args, int l)
44 {
45 int limit = ((Args *)args)->limit;
46 Field newField;
47 Array array;
48
49 if (DXEmptyField(field))
50 return DXEndField(DXNewField());
51
52 field = (Field)DXCopy((Object)field, COPY_STRUCTURE);
53 if (! field)
54 return NULL;
55
56 array = (Array)DXGetComponentValue(field, "connections");
57
58 if (DXQueryGridConnections(array, NULL, NULL))
59 newField = _dxfRefineReg(field, limit);
60 else
61 newField = _dxfRefineIrreg(field, limit);
62
63 if (newField == NULL)
64 DXDelete((Object)field);
65
66 return newField;
67 }
68